Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

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:09

Executing Javascript From A Menu Option


Poster: wwilliam
Dated: Thursday September 25 2003 - 15:25:01 BST

I am using IE6 exclusively for this app and I have the following line in one of my submenus:

aI("text=ADR - Court Ops;url=javascript:window.open('http://webcontent.courtnet.org/w1_www/oca/ct_ops/adr.htm','UBS','width=800,height=600,resizable=yes,scrollbars=yes,toolbar=yes,location=yes,status=yes,menubar=yes');");


It executes fine and opens the seperate browser window and displays the correct page.

The problem that occurs, is that my page in the other browser window goes away and is replaced by a page that just says "[object]".

Does the syntax of this menu option need to be adjusted ??

Thanks.


Poster: John
Dated: Friday September 26 2003 - 2:44:08 BST

Got a URL we can look at?

You may have to escape the quotes with a \ .


Poster: Hergio
Dated: Friday September 26 2003 - 2:53:01 BST

Pull the javascript function call out of the menu item and call a simpler function. In that simpler function, do the window.open(). The reason I think this happens is because window.open returns a window object reference (which can be used in later code to determine if the window was successfully loaded). I believe the menu is trying to get your page to navigate to this 'window object reference'. In my example below, I defined winPop right after the drawmenus function call, but you can define it anywhere, in another file, in the head of your page, whereever. And note, you could make your winPop function parameterized, so that you could pass in a URL and thats where the pop up would navigate to.
Code:
.....
aI("text=ADR - Court Ops;url=javascript:winPop();");
}

drawMenus();

function winPop()
{
  ///the line below should be one line, I chopped it up for the forum
  window.open('http://webcontent.courtnet.org/w1_www/oca/ct_ops/adr.htm', '
UBS','width=800,height=600,resizable=yes,
scrollbars=yes,toolbar=yes,location=yes,status=yes,menubar=yes');
}

Thanks !!


Poster: wwilliam
Dated: Friday September 26 2003 - 13:24:26 BST

That worked great !!!