Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:16
Java window 'bug'
Poster: fredlongworthhighschool
Dated: Wednesday August 27 2003 - 9:45:15 BST
I think this may be a broswer bug rather than anything wrong with the menu but here is the scenario.
On a web page we have a couple of animated icons (spinning globe for the web, rotating 'email' logo for mail) for the kids.
These work fine in conjunction with the menu opening and closing and suchlike.
But, there is a 'faq' part to the menu, when you click on a menu it opens up a Java message window (the one with the exclaimation mark in a yellow triangle).
After this opens it stops the animation in the images. You have to refresh the page to start them again.
I was just wondering if anyone else had the same problem?
Poster: Hergio
Dated: Wednesday August 27 2003 - 14:10:15 BST
You will also notice this on the forum too...when you click to add a smiley, the smiley animations stop. This has to do with the way javascript is being called. The way to prevent this is to not call the javascript from the href of an <a> tag. Doing this: <a href="javascript:doSomething();"> will cause the animated gifs in a page to fail. To correct the problem, you need to use the onClick event like this <a onClick="doSomething();return false;" href=#>. Its better to return false (unless you need it to be true) to make sure the animated gifs dont stop, but sometimes you dont need it..not sure why. YOu can also make doSomething() return false as well.
Now, the problem now lies with the menu. As far as I can tell, there is no onClick parameter, just the url which we use to send javascript. To get around this, Andy, we will need to implement an onClick property of the aI function that will allow one to assign something to the onClick event of the menu item. Whaddya think Andy?
Poster: fredlongworthhighschool
Dated: Wednesday August 27 2003 - 14:13:32 BST
Tried it with Opera - no problems at all. I might have guessed it was IE specific!
Poster: Hergio
Dated: Wednesday August 27 2003 - 14:15:08 BST
Yes it is IE specific, and you can test it out with any animated gif with any call to javascript in that type of way...but for us to fix it in the menu, we will need to get at the onClick event of the menu item.
Poster: fredlongworthhighschool
Dated: Tuesday September 2 2003 - 11:50:03 BST
I've finally got aroun to looking at this. The problem is that I don't call the script from a <a> tag. Instead I am doing the following:
Code:
aI("text=I cannot log on. What do I do?;url=javascript:alert(jsi)");
Poster: Hergio
Dated: Tuesday September 2 2003 - 14:12:12 BST
Actually Andy, you are using an <a> tag. In the menu, when you specify the url= field, it takes whatever you put there and puts it into the href attr. of an <a> tag. Heres the raw HTML for a menu item that my menu generated.
Code:
<TD id=el9 onmouseover=_popi(9); style="BORDER-RIGHT: 0px; PADDING-RIGHT: 3px; BORDER-TOP: 0px; PADDING-LEFT: 3px; FONT-WEIGHT: normal; FONT-SIZE: 90%; BACKGROUND: #ecf6ff; PADDING-BOTTOM: 3px; BORDER-LEFT: 0px; CURSOR: hand; COLOR: #000000; PADDING-TOP: 3px; BORDER-BOTTOM: 0px; FONT-STYLE: normal; FONT-FAMILY: Verdana, Arial" onclick=lc(9);c_openMenu(9) onmouseout='_mot=setTimeout("itemOff(9)",100)' itemOn="0">\
<A id=lnk9 href="javascript:alert('You Clicked Me!')"></A>JavaTest</TD>
<A id=lnk9 href="javascript:alert('You Clicked Me!')"></A>JavaTest</TD>
As you can see, the javascript call is in the href of the <a> tag and thats the problem IE has, that when its in the href, it causes other things to stop. Try having whatever function it is that you are calling return false to see if that clears up the problem. In the meantime, maybe the menu could support an onClick attrbute for menu items that would put whatever you want in the onClick even of the <a> tag. We'll see...