Solved

Open window -- centered on screen

Posted on 2004-08-23
2
317 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 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
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…

707 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