Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Open window -- centered on screen

Posted on 2004-08-23
2
Medium Priority
?
319 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:Tom Knowlton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article discusses how to implement server side field validation and display customized error messages to the client.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
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…

610 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