Click to See Complete Forum and Search --> : Time Delay Mouseover Link?
Does anyone know where I can find a script that will create a timed delay on a mouseover link? I need something that will take my visitors to a new URL after a certain period of time when they have moved their mouse over a particular portion of my intro page. I've found scripts that perform these two functions seperately, but nothing that would cover both (unless there would happen to be a way that I could combine the two scripts). Thank you in advance for any advice that might be usefull . . . ~Maxx
Nicodemas
02-03-2003, 02:47 AM
Depending on what it is that you need the user to mouseover... I'll just provide a sample that you can place wherever you need it, k?
<SCRIPT LANGUAGE="javascript">
<!-- THE JAVASCRIPT NEEDED TO FUNCTION
function timer(){
setTimeout("golink()",3000);
}
function golink(){
parent.location = "http://www.yahoo.com";
}
</SCRIPT>
-->
<!-- PLACE THIS ON THE OBJECT THAT NEEDS THE MOUSEOVER-->
onMouseover="timer()"
Thank you Rob! I'll give this one a try. The fact is that the mouseover link is actually going to be the whole page. I have a basic slide show applet running as an intro for my sight, and I need visitors to be taken to the next page after the slide show ends without having to click on anything. So I'm going to make the link the entire page and assume that my visitors mouse will have entered the browser at some point after the slide show starts. That's what I'm hoping for any way. We'll see. Thanx again . . . ~Maxx
AdamGundry
02-03-2003, 09:06 AM
In that case, you could put a setTimeout in the body's onLoad event handler, so the mouseover is not required.
Adam
That sounds a lot easier and a bit less messy. How do I go about doing this Adam?
Nicodemas
02-04-2003, 02:14 AM
Maxx, read your post about the time crunch, hope this helps.
The above example I included (the onMouseover="timer()") would be changed to something different.
In your pages's <BODY> tag, you could put this:
<BODY onLoad="setTimeout('golink()',3000)">
--------------------------------------------------------------
I sorta went back and revamped the function. Made it reusable by different things on your page. You can try it if you want.
New Script
<SCRIPT LANGUAGE="javascript">
<!-- THE JAVASCRIPT NEEDED TO FUNCTION
function golink(url){
parent.location = url;
}
</SCRIPT>
New <BODY> tag
<BODY onLoad=setTimeout('golink("http://www.ebay.com")',3000)>
Explanation
For each object on your page that you want an onMouseover event for, you simply add the onMouseover=setTimeout('golink("whatever_url_you_want_to_go_to")',3000) to the tag. The 3000 is the number of milliseconds you want to wait until the browser executes golink(). So, 4000 would be 4 seconds.. 10000 would be 10 seconds.. etc...
Hope this helps..
You are a genious and a saint Rob! I especially appreciate the thorough explanation, as I hope to someday sit down and at least figure out the basics of scripting. At any rate - I have no doubt that this will work quite well. Many thanx! ~Maxx