I have six images on a page and want to create a mouse over tooltip (popup?) with links. I found the code below and it works well, except if I have more than one tooltip the timer does not seem to work, also, if I move the mouse I get several tooltips at once. I tried adding a close button to the tooltip display and to have only one tooltip active at a time but was not too successful. I would appreciate any help or suggestions on how to display only one tooltip at a time. Thanks... Ronnie
<SCRIPT LANGUAGE = "JavaScript">
<!--
var tt;
var ttnum;
var q;
var s = null;
var timer_on = false;
function setup_timer(tt){
q=4;stopcounter(tt, ttnum);
start_timer(ttnum);}
function stopcounter(tt){
if (tt==1){
ttnum= "tooltip1";
document.getElementById('tooltip1').style.display='block'; }
if (tt==2){
ttnum= "tooltip2";
document.getElementById('tooltip2').style.display='block'; }
if (tt==3){
ttnum= "tooltip3";
document.getElementById('tooltip3').style.display='block'; }
if (tt==4){
ttnum= "tooltip4";
document.getElementById('tooltip4').style.display='block'; }
if (tt==5){
ttnum= "tooltip5";
document.getElementById('tooltip5').style.display='block'; }
if (tt==6){
ttnum= "tooltip6";
document.getElementById('tooltip6').style.display='block'; }
if(timer_on){clearTimeout(s);}
timer_on=false;}
function start_timer(ttnum){
if (q==0){stopcounter();bye(ttnum);}
else {q=q-1;timer_on=true;
s=self.setTimeout("start_timer(ttnum)",1000);}}
function bye(){
document.getElementById(ttnum).style.display = 'none';
tt=0;
}
//-->
</SCRIPT>
....
<div class="thumbnail">
<form>
<input onmouseover="setup_timer(1)" alt="test1" src=" type="image"/>
<span>test pic</span>
</form>
</div>
...
<div id="tooltip1">
<p>
<b>Tip 1</b>
<a href=" (optional)</a>
</p>
</div>
<SCRIPT LANGUAGE = "JavaScript">
<!--
var tt;
var ttnum;
var q;
var s = null;
var timer_on = false;
function setup_timer(tt){
q=4;stopcounter(tt, ttnum);
start_timer(ttnum);}
function stopcounter(tt){
if (tt==1){
ttnum= "tooltip1";
document.getElementById('tooltip1').style.display='block'; }
if (tt==2){
ttnum= "tooltip2";
document.getElementById('tooltip2').style.display='block'; }
if (tt==3){
ttnum= "tooltip3";
document.getElementById('tooltip3').style.display='block'; }
if (tt==4){
ttnum= "tooltip4";
document.getElementById('tooltip4').style.display='block'; }
if (tt==5){
ttnum= "tooltip5";
document.getElementById('tooltip5').style.display='block'; }
if (tt==6){
ttnum= "tooltip6";
document.getElementById('tooltip6').style.display='block'; }
if(timer_on){clearTimeout(s);}
timer_on=false;}
function start_timer(ttnum){
if (q==0){stopcounter();bye(ttnum);}
else {q=q-1;timer_on=true;
s=self.setTimeout("start_timer(ttnum)",1000);}}
function bye(){
document.getElementById(ttnum).style.display = 'none';
tt=0;
}
//-->
</SCRIPT>
....
<div class="thumbnail">
<form>
<input onmouseover="setup_timer(1)" alt="test1" src=" type="image"/>
<span>test pic</span>
</form>
</div>
...
<div id="tooltip1">
<p>
<b>Tip 1</b>
<a href=" (optional)</a>
</p>
</div>