<html>
<head>
<title>swapimage</title>
</head>
<script>
var arr=["C:\Documents and Settings\Mohan Krishna\Desktop\ku20.gif","C:\Documents and Settings\Mohan Krishna\Desktop\b30.gif","C:\Documents and Settings\Mohan Krishna\Desktop\goku12.gif"];
i=0;
function swap()
{
document.images[0].src=arr[i];
i++;
if(i==3)
i=0;
setTimeOut("swap()",5000);
}
</script>
<body bgcolor="white">
<marquee behaviour="alternate" direction="left"><img src="C:\Documents and Settings\Mohan Krishna\Desktop\UNUSED DESKTOP ITEMS\batman5.gif" onClick=swap()>
</marquee>
</body>
</html>
ghostrecog 0
Newbie Poster
Recommended Answers
Jump to PostThink I made just one adjustment and it works now.
<html> <head> <title>swapimage</title> </head> <script> var arr=["img/wysiwyg_buttons/bold.gif","img/wysiwyg_buttons/italic.gif","img/wysiwyg_buttons/strike.gif"]; i=0; function swap() { document.images[0].src=arr[i]; i++; if(i==3) i=0; setTimeOut("swap()",5000); } </script> <body bgcolor="white"> <marquee behaviour="alternate" direction="left" onClick="swap();"><img src="img/wysiwyg_buttons/link.gif" > </marquee> </marquee> </body> </html>
After I moved the onclick event, it …
Jump to Post> unable to swap images using arrays in javascript
Not surprising considering that the
marquee
tag is non-standard, deprecated and has noonclick
attribute.
All 8 Replies
R0bb0b 344
Posting Shark
~s.o.s~ 2,560
Failure as a human Team Colleague Featured Poster
Troy III 272
Posting Pro
ghostrecog 0
Newbie Poster
R0bb0b 344
Posting Shark
ghostrecog 0
Newbie Poster
R0bb0b 344
Posting Shark
Troy III 272
Posting Pro
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.