xcandiottix Posted July 2, 2010 Share Posted July 2, 2010 How could I code a function that waits for the visitor to move their mouse, executes a code when they move the mouse, then the function times out after say a second. So basically If a user visits my site, there is a hidden table, when the user moves their mouse it "wakes up" the mousemove code which displays a table, then the code goes to sleep so the user can interact with the table. If the code doesnt go back to sleep the table just keeps refreshing it self every mouse move. Here's the code I need to only happen once: window.onmousemove=function(f){ title1=xmlDoc.getElementsByTagName("Name")[0].getElementsByTagName("Cell")[0].getElementsByTagName("title")[0].childNodes[0].nodeValue; document.getElementById("title1").innerHTML=title1; }; The reason I am doing this is because if I use window.onload it will not show the table. If I use onmousemove the table appears. I think there is a conflict between where my include is nested and where the XML is loaded but the page is +800 lines of code and this seems like an easier work around to try this. Any better ideas are also welcome! Thanks Link to comment https://forums.phpfreaks.com/topic/206552-end-onmousemove-with-timing-event/ Share on other sites More sharing options...
xcandiottix Posted July 9, 2010 Author Share Posted July 9, 2010 Here's how... window.onmousemove=function(){ window.onmousemove=null; title1=xmlDoc.getElementsByTagName("Name")[0].getElementsByTagName("Cell")[0].getElementsByTagName("title")[0].childNodes[0].nodeValue; document.getElementById("title1").innerHTML=title1; }; Link to comment https://forums.phpfreaks.com/topic/206552-end-onmousemove-with-timing-event/#findComment-1083778 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.