Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How tocenter a popup window

Status
Not open for further replies.

jsnunez

MIS
Feb 4, 2004
72
0
0
US
Hi all,

How can I center a popup window ?
How can check the screen resolution?

here is the asp.net vb code I am using to popup the window:
Dim popupScript As String = "<script language='javascript'>" & _
"window.open('dialogAttributes.aspx', 'Attributes', " & _
"'width=300, height=300, menubar=yes, scrollbars=yes, resizable=yes')" & _
"</script>"

If (Not Me.Page.IsStartupScriptRegistered("StartUp")) Then
Me.Page.RegisterStartupScript("Startup", popupScript)
End If


thanks
jsn
 
You'll have to use a javascript function to check the client's screen resolution, pass those details back to the server and then omit the relevant javascript.

I'd ask in the javascript forum for the best way to get those details and submit them.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
jsn: Here is an example of opening a childwindow and centering it on the page using javascript:
Code:
function getY2(){
 var fr=frames['myIframe'].document.forms[0]; 
 var strPg; 
 var w = window.screen.availWidth;
 w = (w-210)/2;
 var h = window.screen.availheight;
 h = (h-150)/2;
 var strCondit = 'left='+ w +',top='+ h +',height=150,width=210,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,minimize=no,copyhistory=no';
 strPg = "qwwSetY2.aspx?Y2Max=" + fr.txtY2Max.value + "&Y2Min=" + fr.txtY2Min.value + "&Y2Int=" + fr.txtY2Int.value
 childWindow = window.open(strPg, 'newWin', strCondit)
}
this particular example extracts values from inside a form's IFRAME and sends them up to the pop-up. There is an alternative code routine for this at the Javascript forum under their FAQs.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top