[Javascript] image swap
Jeffrey Morin
j_morin2003 at yahoo.com
Mon Jul 16 17:20:58 CDT 2007
hi everyone,
i am just starting to learn JavaScript and could really use some help. i am trying to do an image swap code with onmouseover. i am just copying and pasting the code out of a book but can't figure out what to change in order to get it to work. it is from the o'reilly JavaScript book. here is the code:
<script type="text/javascript">
function rollOver()
{
var images = document.getElementsByTagName("img");
for(var i = 0; i < images.length; i++);
{
var image = images[i];
var rolloverURL = image.getAttribute("rollover");
if (rolloverURL) addRollover(image, rolloverURL);
}
}
</script>
<script>
if (window.addEventListener)
window.addEventListener("load", rollOver, false);
else if (window.attachEvent)
window.attachEvent("onload", rollOver);
</script>
so the first part is the actual function and the second calls it right? my question is which parts need to be modified. i have tried entering url's and still get nothing. the latest error i get is that the image has no properties. can someone help me out with this. i would really appreciate it. i was told JavaScript was fairly easy to learn, i think i was lied to.
Jeff
---------------------------------
Sick sense of humor? Visit Yahoo! TV's Comedy with an Edge to see what's on, when.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20070716/1bbdd0d2/attachment.htm>
More information about the Javascript
mailing list