Jump to content

Timed delay on mouseout


METOOTECH
 Share

Recommended Posts

Hi, I was wondering how do you code a timed delay mouseout? Here is some code examples that I tried that didn't work.... METOOTECH<img id="ads2" src="http://www.knifeknives.com/ba/backs-logos/SUNSPOT1B.jpg"'>http://www.knifeknives.com/ba/backs-logos/SUNSPOT1B.jpg" height="130" width="130" border="0" onmouseover="this.src='http://www.knifeknives.com/ba/backs-logos/DARKSTAR2.jpg'" onmouseout="setTimeout('this.src=(http://www.knifeknives.com/ba/backs-logos/SUNSPOT1B.jpg)', 5000)"><img id="ads2" src="http://www.knifeknives.com/ba/backs-logos/SUNSPOT1B.jpg"'>http://www.knifeknives.com/ba/backs-logos/SUNSPOT1B.jpg" height="130" width="130" border="0" onmouseover="this.src='http://www.knifeknives.com/ba/backs-logos/DARKSTAR2.jpg'" onmouseout="setTimeout(5000); this.src='http://www.knifeknives.com/ba/backs-logos/SUNSPOT1B.jpg'">

Link to comment
Share on other sites

This would be the correct syntax but i'm not sure this is allowed.onmouseout="setTimeout('this.src=\'SUNSPOT1B.jpg\'', 5000)">From what i can remember the first argument of a setTimeout must be a function :)

Link to comment
Share on other sites

This would be the correct syntax but i'm not sure this is allowed.onmouseout="setTimeout('this.src=\'SUNSPOT1B.jpg\'', 5000)">From what i can remember the first argument of a setTimeout must be a function :)

No guy, it didn't work and neither did this.....onmouseout="setTimeout('this.src(\'SUNSPOT1B.jpg\')', 5000)">Hummm, any way to code the function inline??
Link to comment
Share on other sites

No guy, it didn't work and neither did this.....onmouseout="setTimeout('this.src(\'SUNSPOT1B.jpg\')', 5000)">Hummm, any way to code the function inline??

Yeah i didn't think so :) plus this.src() is not a function so you couldn't use it like that.
Link to comment
Share on other sites

Hummm, any way to code the function inline??
Put the function in the body, it's not best practise but if you have no choice...
<body><script>function go() {document.getElementById('ads2').src="SUNSPOT1B.jpg";}</script><img id="ads2" src="http://www.knifeknives.com/ba/backs-logos/SUNSPOT1B.jpg" height="130" width="130" border="0" onmouseover="this.src='http://www.knifeknives.com/ba/backs-logos/DARKSTAR2.jpg'" onmouseout="setTimeout('go()', 5000)"></body>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...