Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

why is onmouseout triggered?

Status
Not open for further replies.

russland

Programmer
Jan 9, 2003
315
CH
i try to build a layer that expands nicely (copy/paste code below)

for some reasone the browser triggers onmouseover when you go over the icon which is on the top. right next to the first entry. why is that????? why does it look at it as a ONMOUSEOUT?

I'd appreciate any help


<html>

<head>
<title>Neue Seite 1</title>
<style type=&quot;text/css&quot;>
body {font-family: Verdana; font-size: 8pt; text-transform : lowercase;}
div {font-family: Verdana; font-size: 8pt; color: gray; cursor: pointer;}
</style>
<script language=&quot;JavaScript&quot;>

//global variable: lock
lock = false;
fakeLock = false;

function expandDropDownBox(currentHeight)
{
var divStart = 14;
var divHeight = 70;
var nInk = currentHeight + 1;

if(lock == true && currentHeight == divStart)
{
// do nothing because already running
//alert(&quot;sorry, it's locked&quot;);
}
else
{
var objDiv = document.getElementById('dropDownBox');
objDiv.style.clip = &quot;rect(0 202 &quot;+ nInk +&quot; 0)&quot;

if(nInk<divHeight)
{
lock = true;
//alert(&quot;repeat&quot;);
window.setTimeout('expandDropDownBox('+nInk+')', 10);
}
else
{
// undo function lock when inkremented value equals the max height
lock = false;
//alert(&quot;unlocked!&quot;);
}
}
}

function collapseDropDownBox(divStart)
{
//fakeLock = true;
var objDiv = document.getElementById('dropDownBox');
objDiv.style.clip = &quot;rect(0 202 &quot;+ divStart +&quot; 0)&quot;
}
</script>


</head>

<body>



<table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;border-collapse: collapse&quot; bordercolor=&quot;#111111&quot; width=&quot;100%&quot;>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>

<div id=&quot;BaseDiv&quot; style=&quot;position: relative;&quot;>
<div id=&quot;dropDownBox&quot; style=&quot;position: absolute; border: 1px solid navy; background-color: efefef; clip: rect(0 202 14 0)&quot; onmouseover=&quot;expandDropDownBox(14)&quot; onmouseout=&quot;collapseDropDownBox(14);&quot;>

&nbsp;&nbsp;bern<img src=&quot;down.gif&quot; width=&quot;19&quot; height=&quot;7&quot; alt=&quot;&quot; border=&quot;0&quot;><br>
&nbsp;&nbsp;luzern<br>
&nbsp;&nbsp;genf<br>
&nbsp;&nbsp;aarau<br>
&nbsp;&nbsp;chur<br>
<table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; width=&quot;200px&quot;>
<tr><td></td></tr>
</table>
</div>
</div>


</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>

</body>

</html>
 
getElementById('dropDownBox');

I'm not a wizard, but I would say that the image is treated as a seperate element.

If you take out the image it works fine.

Possible solution would be to get the images as well to work into the script.

DeZiner
Never be afraid to try something new.
Remember that amateurs built the Ark.
Professionals built the Titanic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top