METOOTECH Posted June 21, 2006 Share Posted June 21, 2006 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 More sharing options...
scott100 Posted June 21, 2006 Share Posted June 21, 2006 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 More sharing options...
METOOTECH Posted June 21, 2006 Author Share Posted June 21, 2006 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 <{POST_SNAPBACK}> 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 More sharing options...
scott100 Posted June 21, 2006 Share Posted June 21, 2006 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??<{POST_SNAPBACK}> 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 More sharing options...
scott100 Posted June 21, 2006 Share Posted June 21, 2006 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 More sharing options...
METOOTECH Posted June 23, 2006 Author Share Posted June 23, 2006 It works great Scotty ..... any way to make it inline code????? Link to comment Share on other sites More sharing options...
scott100 Posted June 23, 2006 Share Posted June 23, 2006 It works great Scotty ..... any way to make it inline code?????<{POST_SNAPBACK}> I don't think so I think your stumped with this one Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now