Back To Start Of Archive
Taken From The Forum: Archived Topics for the old Version 3.0 JavaScript Menu
Forum Topic: Click to view post
Last Updated: Wednesday July 18 2012 - 06:07:35
With HTML Tags in Description Text, OnClick event don't fire
Poster: apressato
Dated: Thursday June 13 2002 - 13:49:57 BST
Hi,
I have noticed that if you put an HTML block like this into the Description Text of a Menu Item, the OnClick event doesen't fire.
Code:
<div class=MyMenuItem>
.
.
.
<img border=0 src=WhoAmI.gif width=24 height=24>
.
.
.
Description Text
</div>
.
.
.
<img border=0 src=WhoAmI.gif width=24 height=24>
.
.
.
Description Text
</div>
More precisely, it fire only if you click on the image but not on the text.
So I have added the following code in function hl() (mmenu.js):
Code:
// AP | 20020613: Added for Custom Object in Text field
if(arg[0].indexOf("<div")>=0)
{
if(menu[11]&&ns6)ns6hif=1
ipos=arg[0].indexOf("<div");
arg[0]=arg[0].substr(0,ipos+4)+" onclick=\"gmobj('el"+el+"').click()\" id=tbl"+el+" "+ arg[0].substr(ipos+5,900);
}
if(arg[0].indexOf("<div")>=0)
{
if(menu[11]&&ns6)ns6hif=1
ipos=arg[0].indexOf("<div");
arg[0]=arg[0].substr(0,ipos+4)+" onclick=\"gmobj('el"+el+"').click()\" id=tbl"+el+" "+ arg[0].substr(ipos+5,900);
}
just after
Code:
if(arg[0].indexOf("<img")>=0)
{
if(menu[11]&&ns6)ns6hif=1
ipos=arg[0].indexOf("<img");
arg[0]=arg[0].substr(0,ipos+4)+" onclick=\"gmobj('el"+el+"').click()\" id=im"+el+" "+ arg[0].substr(ipos+5,900);
}
{
if(menu[11]&&ns6)ns6hif=1
ipos=arg[0].indexOf("<img");
arg[0]=arg[0].substr(0,ipos+4)+" onclick=\"gmobj('el"+el+"').click()\" id=im"+el+" "+ arg[0].substr(ipos+5,900);
}
and work very fine !