How to change the size of a modal browser window?

F

feng

I am using the following JavaScript to diplay a modal
window:

window.showModalDialog('Open/QicWebError.aspx', " & _
"'_blank', 'height=380, width=520, " & _
"location=no, menubar=no, titlebar=no,
toolbar=no', true);

But the problem is that I can't set the size of the
window. The settings I use in the script doesn't seem to
work and I can't make it resizeable either.

Please help.
 
K

Ken Cox [Microsoft MVP]

You have some syntax errors for that method. It doesn't use the same
parameter names as the regular Window.Open() method.

There's info on it here:

http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/showmodaldialog.asp?frame=true

Here's an example where it works:

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Dim sb As New System.Text.StringBuilder
sb.Append("window.showModalDialog('")
sb.Append("http://www.gc.ca', null,")
sb.Append("'dialogWidth:180px;dialogHeight:120px;location:no;")
sb.Append("menubar:no;titlebar:no;toolbar:no')")
sb.Append(";return false;")
Button1.Attributes.Add("onclick", sb.ToString)
End Sub

Ken
Microsoft MVP [ASP.NET]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top