Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple script to change image and wait x seconds 1

Status
Not open for further replies.

CC801340

IS-IT--Management
Jul 10, 2001
147
GB
Hi

I am after a piece of script that will do the following when a user clicks an image:

1) changes the image
2) waits 2 seconds
3) moves to a another page

Many thanks in advance
 
here ya go :) :
Code:
<script language=&quot;javascript&quot;><!--
function swapImage()
{
e = event.srcElement;
e.src = 'theNewImage.bmp';
setTimeout(&quot;document.location.href = 'newPage.html'&quot;,2000);
}
//--></script>

and you could call it from the image like this:
Code:
<img src='firstimage.bmp' onClick='swapImage()'>

hope it helps &quot;Those who dare to fail miserably can achieve greatly.&quot; - Robert F. Kennedy
So true..
 
Geat! Thanks for that! Much appreciated!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top