I have the following image and button code:
<code> <img id="someimage" src="Image1.gif" alt = "" /></code>
.....
<code><li><a class="button1" href="javascript:void()" onclick="javascript:activateNewWindow()"></a></li></code>
This func will replace the Image1.gif image on my page with an animated GIF that runs for 5 seconds. At the end of that time, it must open a new window and display a new page.
Here is func JS code:
<code>function activateNewWindow()
{
/* change image to the Animated gif which will run for 5 sec */
document.getElementById('someimage').src="AnimatedGIF.gif";
window.setTimeout("activateNewWindow()",5000);
}
function activateNewWindow()
{
window.open("SomeNewHTMLPage.html", "", "toolbar=0,location=0, status=0, menubar=0,scrollbars=1,resizable=1");
}
</code>
Problem is, either setTimeout isn't firing or, more likely, I have made a mistake. Image gets replaced but the new window never opens.I can't use setTimeout in the onclick because the image needs to get replaced immediately, and then the new window needs to open.
Any ideas what I am doing wrong? Any help appreciated
<code> <img id="someimage" src="Image1.gif" alt = "" /></code>
.....
<code><li><a class="button1" href="javascript:void()" onclick="javascript:activateNewWindow()"></a></li></code>
This func will replace the Image1.gif image on my page with an animated GIF that runs for 5 seconds. At the end of that time, it must open a new window and display a new page.
Here is func JS code:
<code>function activateNewWindow()
{
/* change image to the Animated gif which will run for 5 sec */
document.getElementById('someimage').src="AnimatedGIF.gif";
window.setTimeout("activateNewWindow()",5000);
}
function activateNewWindow()
{
window.open("SomeNewHTMLPage.html", "", "toolbar=0,location=0, status=0, menubar=0,scrollbars=1,resizable=1");
}
</code>
Problem is, either setTimeout isn't firing or, more likely, I have made a mistake. Image gets replaced but the new window never opens.I can't use setTimeout in the onclick because the image needs to get replaced immediately, and then the new window needs to open.
Any ideas what I am doing wrong? Any help appreciated