ShowModalDialog in Milonic menus

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
hamipers
Beginner
Beginner
Posts: 2
Joined: Fri Aug 12, 2005 2:08 pm

ShowModalDialog in Milonic menus

Post by hamipers »

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
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

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

aI("text=Open Whatever;url=javascript:newWin=window.showModalDialog('whatever.html','','help:No;status:No;resizable:Yes');");
Using the clickfunction property:

Code: Select all

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
Post Reply