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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onmouseover event

Status
Not open for further replies.

dinger2121

Programmer
Sep 11, 2007
439
US
Hello,
I am using the following code to create a menu drop down (see below)
The code works fine. I then tried changing the text to a hyperlink, and the drop down is delayed. That is the only thing that changed - adding a <A> tag around the text to make it a hyperlink.
Does anyone have any idea why that might be happening?

Thanks

function document.onmouseover()
{
var eSrc = window.event.srcElement;
if ("clsMenuBarItem" == eSrc.className)
{
eSrc.style.color = "White";
var eMenu = document.all[eSrc.id.replace("tdMenuBarItem","divMenu")];
if (eOpenMenu && eOpenMenu != eMenu)
{
CloseMenu(eOpenMenu);
}
if (eMenu)
{
OpenMenu(eSrc,eMenu);
}
}
else if (eOpenMenu && !eOpenMenu.contains(eSrc) && !divMenuBar.contains(eSrc))
{
CloseMenu(eOpenMenu);
}
}
 
I don't see the <A> tag in here. Can you please provide the rest of the code? Especially for OpenMenu and Close Menu?

Also, please use the [ code ] tag when posting your code.
 
I've seen this before - especially in IE. A regular span, etc, with onlick will have the onclick fire immediately. With an anchor, it will not always fire immediately.

Do you really need an anchor? If not, stick without it and style the element as you need (e.g. cursor:pointer, etc).

If you need an anchor, perhaps you need to add 'return false' to its onclick handler?

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
thanks for the input. I have to use an anchor because I am using an xsl stylesheet to create a menu. below is the code from the xsl. I don't know any other way to add the hyperlink - any thoughts would be great.
Thanks again.

Code:
<A>
      <xsl:attribute name="HREF">[URL unfurl="true"]http://www.mySite.com<xsl:value-of[/URL] select="@URL" /></xsl:attribute>
      
      <xsl:value-of select="@TYPE" />
      </A>
 
I was able to accomplish what I needed by adding an xsl attribute to my table cell, therefore eliminating the anchor tags.
below is the code.
Thanks for everyone's help.

Code:
<xsl:attribute name="onclick">document.location.href='[URL unfurl="true"]http://www.mySite.com<xsl:value-of[/URL] select="@URL" />';</xsl:attribute>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top