Java window 'bug'

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
User avatar
fredlongworthhighschool
Mega Advanced
Mega Advanced
Posts: 362
Joined: Fri Jun 27, 2003 11:34 am
Location: Manchester, England.
Contact:

Java window 'bug'

Post by fredlongworthhighschool »

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?
Andy Davis
Web Designer & Smartboard Manager

Fred Longworth High School, Manchester, England.
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

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?
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
User avatar
fredlongworthhighschool
Mega Advanced
Mega Advanced
Posts: 362
Joined: Fri Jun 27, 2003 11:34 am
Location: Manchester, England.
Contact:

Post by fredlongworthhighschool »

Tried it with Opera - no problems at all. I might have guessed it was IE specific!
Andy Davis
Web Designer & Smartboard Manager

Fred Longworth High School, Manchester, England.
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

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.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
User avatar
fredlongworthhighschool
Mega Advanced
Mega Advanced
Posts: 362
Joined: Fri Jun 27, 2003 11:34 am
Location: Manchester, England.
Contact:

Post by fredlongworthhighschool »

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: Select all

aI("text=I cannot log on. What do I do?;url=javascript:alert(jsi)");
Andy Davis
Web Designer & Smartboard Manager

Fred Longworth High School, Manchester, England.
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

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: Select all

<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>
[/size]
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...
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
Post Reply