Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

centering window in center of any monitor size? 1

Status
Not open for further replies.

loopsta

MIS
Nov 16, 2001
47
US
Sorry if my last post was not clear, but I want my new window to open in the centre of the viewers monitor screen, no matter what size monitors they r using, thanks for any advice
 
To do this you have to use JavaScript.
Dreamweaver doesn't compile very sound JS in my experience but those nice guys at internet.com (Eric King wrote this paticular script) have the source there for you to download for free...


<!-- TWO STEPS TO INSTALL CENTERED POPUP:

1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->

<HEAD>

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!-- Original: Eric King (eric_andrew_king@hotmail.com) -->
<!-- Web Site: -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! -->

<!-- Begin
function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
// End -->
</script>
</HEAD>

<!-- STEP TWO: Copy this code into the BODY of your HTML document -->

<BODY>

<!-- Put the URL inside the link's href=&quot;...&quot; section, then carefully -->
<!-- change 'name' to a name for your popup window. The last three -->
<!-- items represent the popup window width, height, and scrollbars. -->

<a href=&quot; onclick=&quot;NewWindow(this.href,'name','400','400','yes');return false;&quot;>Popup Yahoo.com</a>

<p><center>
<font face=&quot;arial, helvetica&quot; size=&quot;-2&quot;>Free JavaScripts provided<br>
by <a href=&quot; JavaScript Source</a></font>
</center><p>

<!-- Script Size: 1.12 KB -->
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top