Solved

Open window -- centered on screen

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now