How to change the size of a modal browser window?

  • Thread starter Thread starter feng
  • Start date Start date
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.
 
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]
 
Back
Top