tags:

views:

295

answers:

4

I am opening a window as a modal. window.showModalDialog("http://www.google.com","","dialogWidth:500px;dialogHeight:500px")

as I set height, what are other options available? Like option buttons, menus etc. where I can find tutorials?

EDIT

It works in Mozilla firefox, but people are saying it doesn't!

My code is

Please somebody Edit my sample code for display purpose

<html>
<head>
<script>
    function abc() {
        window.showModalDialog("3.htm", "", "dialogWidth:500px;dialogHeight:500px");
    }
</script>
</head>
<body>
<input type="button" id="check" name="check" onclick="abc()" value="open"/>
</body>
</html>

Second EDIT

code for page 3.htm

     <html>
<head>
<script>
function abc(){
close()
}
</script>
</head>
<body>
<input type="button" id="check" name="check" onclick="abc()" value="close"/>
</body>
</html>

Check out both code on fire fox! and tell me.

Third EDIT

Ok It's not working in corme and opera

A: 

Be aware that showModalDialog is IE specific and won't necessarily work with other browsers. If you want cross browser modal dialogs you need to use a div to hide the rest of the page and overlay your dialog on top. It is easier to use an existing javascript library that already takes care of this.

Steven
This is no longer true as of Firefox 3.
cdmckay
A: 

I suggest not to use popups in web apps. Use floating divs instead which looks like a modal dialog but are better than the popups.

Ramesh Soni
A: 

JQuery UI has a decent popup/modal dialog API and I've worked with the Boxy plugin which is very easy to implement.

They're cross browser and simple to use.

Fermin
Yes I've seen that, but they fails to open new page on the same boxy window.
Vikas
A: 

To load a page using boxy use:

var boxyPopup;
Boxy.load("aPage.html",
   {title: "Title",
   modal: true,
   fixed: false,
   afterShow: function(){
    boxyPopup = this;}});

I'm not sure what you mean by it not opening a new page on same boxy window but using the above you have the boxyPopup var as a reference to the open boxy object and can access/change contents using that.

Fermin