Solved

Open window -- centered on screen

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

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
Validating Date Part2 2 27
javascript form submition 2 22
Html using "Or" in condition 3 27
How do I Enable submit button only if listbox has items 4 34
In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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…

733 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