Board Logo

Menu, problems with the modal windows
nahiko - 10/30/2007 at 12:04 PM

Hi everyone

I have been using the Tigra Menu for a while, always with non-modal windows, but now, I need to use it in a modal window.

And I have a problem, and it is that, when I set some javascript code in the link of an item of the menu, when I click it, the menu tries to open a new window (because the first one is modal) with the same URL that the code in the link, for example, if the code in the link is

javascript:alert('hi world');

it will try to open a new window with the URL "alert('hi world')" what is kind of weird...

Does anyone have a solution for this? I would need it to execute that code, not to open a new window with that URL :-S

Thanks in advance!! :D


tigra - 10/31/2007 at 12:51 AM

you can modify the script so <div onclick="..."> used instead of <a href="...">
this should take care of the issue

nahiko - 11/9/2007 at 11:21 AM

Hi Tigra!!

Thanx for your answer, I tried that, but it did not work for me because I modified a lot the former tigra.js file and the styles broke when I put a "div" instead of an "a href"

But I got to solve my problem this way:

in the method "menu_onclick(n_id)" I changed what I had, and I put

event.cancelBubble = true;
window.event.keyCode = 0;
window.event.returnValue = false;
return true;

So the link code gets "evaled" and not clicked because the event click is cancel as well as the bubble cancelled. Fortunatelly, the onclick executes before the href :D
And even being a modal window, if I eval the link it does not open a new window :D

Maybe this can also solve some problems to someone else !!

Even changing the code, the line "// URL:" is still in the file ;-)

Greetings and thanks a lot!!


Back to forum: