Networking | Hardware | Software | Multimedia | System | Unix&Linux | MBA

Home>>Hardware>>No-image representation

No-image representation

ken_shoti
01-08-2006, 02:03 PM
How can i make use of an image to replace all images that seems not to exist? (image to replace those image-placeholders-like)

vwphillips
01-08-2006, 05:07 PM
see
http://www.vicsjavascripts.org.uk/MissingImage/MissingImage.htm

coothead
01-08-2006, 06:41 PM
Hi there ken_shoti,

here is another example that you may find of interest...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>set a source to dead images</title>
<base href=http://codingforums.com/archive/index.php/"http://coothead.homestead.com/files/">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">
<!--
body {
background-color:#333;
color:#fff;
}
#clck {
text-align:center;
margin:20px;
cursor:pointer;
}
#img_container {
text-align:center;
}
img {
border:3px double #0f0;
}
-->
</style>

<script type="text/javascript">
<!--
var set=new Array();
set[0]='apple0.jpg';
set[1]='apple1.jpg';
set[2]='apple2.jpg';
set[3]='apple3.jpg';
set[4]='apple4.jpg';
set[5]='apple5.jpg';
var pics=document.getElementsByTagName('img');

function addImageSrc() {

for(c=0;c<pics.length;c++) {
num=c%set.length;

//IE shows img width as 28, Opera as 1 and Firefox as 0, so test for each browser


if((pics[c].width==28)||(pics[c].width==1)||(pics[c].width==0)) {
pics[c].src=set[num];
}
}
}
//-->
</script>

</head>
<body>

<div id="clck" onclick="addImageSrc()">click here to give dead images a src</div>

<div id="img_container">
<img src=http://codingforums.com/archive/index.php/"apple0.jpg" alt=""/>
<img src=http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/"bad.jpg" alt=""/>
<img src=http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/"rotten.jpg" alt=""/>
<img src=http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/"foul.jpg" alt=""/>
<img src=http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/"rubbish.jpg" alt=""/>
<img src=http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/"awful.jpg" alt=""/>
<img src=http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/"off.jpg" alt=""/>
<img src=http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/"bad.jpg" alt=""/>
<img src=http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/"rotten.jpg" alt=""/>
<img src=http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/"foul.jpg" alt=""/>
<img src=http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/"rubbish.jpg" alt=""/>
<img src=http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/"awful.jpg" alt=""/>
<img src=http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/"off.jpg" alt=""/>
<img src=http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/"bad.jpg" alt=""/>
<img src=http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/"rotten.jpg" alt=""/>
<img src=http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/"foul.jpg" alt=""/>
<img src=http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/"rubbish.jpg" alt=""/>
<img src=http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/http://codingforums.com/archive/index.php/"awful.jpg" alt=""/>
</div>

</body>
</html>
I have used onclick for the example but onload could be used. :)

coothead


 

TOP

Hyperthreading hurts s
HP sharpens blade PC l
Apple goes for Quad po
Itanium gets scaled do

For more info

Hyperthreading hurts s
HP sharpens blade PC l
problem with an ImageP
Modifying a navigation
convert text to intege
Anyone knows to clear 
Automatically generate
document.getElementByI
Hi question about stor
Netscape Problems :-( 

News Archive

Month and Year drop do
navigation button/imag
doubt in window.open()
undo redo script 
Mimick "View Source" w
print Question 
No-image representatio
What's wrong with this
Urgent help in Javascr
Gurt Menu assistance 

Related stories:

Month and Year drop down selection boxes
navigation button/image
doubt in window.open()
undo redo script
Mimick "View Source" with JavaScript
print Question

Copyright@2004-2005 www.zzcoke.com All Right Reserved

advanced web statistics