<!-- Javascript: displays the document.images collection -->
<HTML>
<HEAD>
<TITLE>document.images Example</TITLE>
</HEAD>
<BODY>
<H3>I am a web page</H3>
<img width=60 src=cookie.gif>
<P>This is a paragraph</P>
<table>
<tr>
<td><img width=60 src=jscook.jpeg></td>
<td><img width=60 src=jsmaster.jpeg></td>
</tr>
<tr>
<td><img width=60 src=js.jpeg></td>
<td><img width=60 src=jsdevel.jpeg></td>
</tr>
</table>
<P>Here comes another</P>
<P>How about a list:</P>
<UL>
<LI>one</LI>
<LI>two</LI>
<LI>three</LI>
</UL>
<SCRIPT>
var txt="";
// for each image, find out the value of the attribute named
// "src" and pring it out.
for (var i=0; i<document.images.length;i++) {
image = document.images[i];
name = image.getAttribute("src");
txt = txt + name +"<BR>";
}
document.writeln("Here are the images found:<BR>\n");
document.write(txt);
</script>
</BODY>
</HTML>
|