Forum Moderators: open
I'm using a script in a page to display either more links or a string of text in a box when the user mouses over a link. Because the user then needs time to move the pointer over to the newly displayed links and make a selection, I used setTimeout() to delay the display box's return to it's default value.
All of this works fine, except when you mouse over several links in a row. The setTimeout() timer seems to start on the first link you mouseover and then times out (and returns to the default text) at the end of the time, even if you have subsequently moved over other links.
What I need to find is a way to clear out the timer when ever a new link is moused over. I'm not sure how to do this.
I would appreciate any help you can give me. Here's the js code. I'm calling the function showDetail(x) with onmouseover and hideDetail() with onmouseout.
Peace.
var details = new Array();
details[0] = "Point to a link for more options and information."
details[1] = "link1: <a href='#'>sublinkOne</a> ¦ <a href='#'>sublinkTwo</a> ¦ <a href='#'>sublinkThree</a> ¦ <a href='#'>sublinkFour</a>"
details[2] = "link2: <a href='#'>sublinkOne</a> ¦ <a href='#'>sublinkTwo</a> ¦ <a href='#'>sublinkThree</a>"
details[3] = "link3: <a href='#'>sublinkOne</a> ¦ <a href='#'>sublinkTwo</a> ¦ <a href='#'>sublinkThree</a> ¦ <a href='#'>sublinkFour</a>"
details[4] = "Send us an e-mail with any questions, comments or concerns."
details[5] = "Information about our company, staff and affiliates."
details[6] = "View the <em>legalese</em> associated with our site."
function showDetail(x) {
for (var i = 0; i < details.length; i++) {
if (i = x) {
var linkDetail = details[i];}
break;}
document.getElementById("detail").innerHTML = linkDetail;
}
function hideDetail() {
setTimeout("document.getElementById('detail').innerHTML = details[0];", 7000);
}
function hideDetail() {
timeSet;
}
doesn't work. I put:
function hideDetail() {
timeSet = setTimeout(blahblahblah);
}
and it did what I wanted, but, again, I get the feeling that's not good form.
var newWin=window.open("","","height=200px");
Now the window can be manipulated simply by applying commands to the newWin variable.