Tooltip in Javascript question; adding a delay

psema4 psema4-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Tue Apr 19 05:19:11 UTC 2005


>    I have started using a wonderful canned tooltip app in my program
> that pops up a little tooltip on key words explaining their purpose in
> greater detail. I want to add a slight (~1 sec) delay between the time
> the user places their mouse over the trigger and the display of the box.

Capture the handle of the timer before you can clear it.  Something
like below should work:

<a onMouseOver="stm('Some Name', 'Some text)" onMouseOut="htm()"></a>

<script type="text/javascript">
/* script assumes form01 exists and contains 2 textboxes */

var timerID;

function stm(name, text) {
	timerID = setTimeout('delayAlarm();', 1000);

	document.form01.frmName.value=name;
	document.form01.frmText.value=text;
	return;
}

function htm() {
	document.form01.frmName.value='';
	document.form01.frmText.value='';
	return;
}

function delayAlarm() {
	/* I want to abort 'stm' if it is still in the delay */

	timerID = clearTimeout(timerID);
	htm();
	return;
}

- Scott.

-- 
- SGE
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list