Solved

Open window -- centered on screen

Posted on 2004-08-23
2
315 Views
Last Modified: 2012-08-13
<td align="center"><img onClick="window.open('closeup.asp?show_pic=<%=rsa("CloseupPath")%>', 'Close-up', 'width=300,height=300, resizable=yes');" src="upload\<%=rsa("PicturePath")%>"><br><%=rsa("PictureTag")%></td>
      <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>


How can I change this to CENTER the window on screen when it opens?
0
Comment
Question by:knowlton
  • 2
2 Comments
 
LVL 15

Expert Comment

by:Colosseo
ID: 11875874
Hi knowlton

try this

notice as well Close-up changed to Closeup

<td align="center"><img onClick="window.open('closeup.asp?show_pic=<%=rsa("CloseupPath")%>', 'Closeup', width=300,height=300, Left='+ (screen.availWidth - 300)/2 +', top=' + (screen.availHeight - 300)/2 + ', resizable=yes');" src="upload\<%=rsa("PicturePath")%>"><br><%=rsa("PictureTag")%></td>
     <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>

Also this might be better as a function

Scott
0
 
LVL 15

Accepted Solution

by:
Colosseo earned 500 total points
ID: 11875925
And here is an example of how you could do it with a function

<html>
<head></head>
<script language="javascript">
function open_Win(str_Url, str_Name, win_Width, win_Height) {
  var win_Left = (screen.availWidth - win_Width)/2
  var win_Top = (screen.availHeight - win_Height)/2
  window.open(str_Url, str_Name, 'width=' + win_Width + ',height=' + win_Height + ', Left=' + win_Left + ', top=' + win_Top + ', resizable=yes');
}
</script>
<body>

<table><tr>
<td align="center"><img onClick="open_Win('closeup.asp?show_pic=<%=rsa("CloseupPath")%>', 'Closeup', 300,300);" src="upload\<%=rsa("PicturePath")%>"><br><%=rsa("PictureTag")%></td>
     <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
</tr></table>
</body>
</html>

HTH

Scott
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question