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:35
ShowModalDialog in Milonic menus
Poster: hamipers
Dated: Friday August 12 2005 - 14:15:02 BST
Hi,
I would like to open a modal web dialog box by this javascript command: showModalDialog(...). I wonder how I can use this command within milonic menus. It's somewhat like opening a page with target="_blank", but It will be modal. Any help will be greatly appreciated!
Schwan
Poster: kevin3442
Dated: Saturday August 13 2005 - 5:22:40 BST
Hi Schwan,
The simplest approach would be to use either the url property or the clickfunction property in the aI() string that defines the menu item. If you use the url property, the syntax would be much the same as if you called showModalDialog() from the href attribute of an <a> tag. If you use the clickfunction property, the syntax would be similar to that used for calling showModalDialog() from an object's onclick attribute. Like so:
Using the url property:
Code:
aI("text=Open Whatever;url=javascript:newWin=window.showModalDialog('whatever.html','','help:No;status:No;resizable:Yes');");
Using the clickfunction property:
Code:
aI("text=Open Whatever;clickfunction=window.showModalDialog('whatever.html','','help:No;status:No;resizable:Yes');");
You should keep in mind that the showModalDialog() method will only work in IE4 and higher. So, if this is not for an intranet, where you can control the browser... i.e., if users might be using any other browser... you might want to wrap the call to showModalDialog() inside of your own function: The function would test for the presence of the window.showModalDialog object before calling showModalDialog(); if the object isn't present, then you'd use window.open() instead.
Hope that made sense. Good luck.
Kevin