• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
JavaScriptSource

JavaScriptSource

Search 5,000+ Free JavaScript Snippets

  • Home
  • Browse Snippets
    • Addon
    • Ajax
    • Buttons
    • Cookies
    • CSS
    • Featured
    • Forms
    • Games
    • Generators
    • Image Effects
    • Math Related
    • Miscellaneous
    • Multimedia
    • Navigation
    • Page Details
    • Passwords
    • Text Effects
    • Time & Date
    • User Details
Home / Buttons / Window Position

Window Position

Window Position

Do you not where window.open() opens your new windows? Using this JavaScript, you can actually have the new window open wherever you want! Look at our example to see what we mean! Really neat!

  1. Paste the first code in the HEAD of your HTML document
  2. Add the last coding to the BODY of your HTML document
<!– STEP ONE: Paste the first code in the HEAD of your HTML document  –>

<HEAD>

<SCRIPT LANGUAGE=”JavaScript”>

<!– This script and many more are available free online at –>
<!– The JavaScript Source!! http://javascriptsource.com –>

<!– Begin
function win() {
msg=window.open(“”,”msg”,”height=200,width=200,left=80,top=80″);
msg.document.write(“<html><title>Windows!</title>”);
msg.document.write(“<body bgcolor=’white’ onblur=window.close()>”);
msg.document.write(“<center>page content here</center>”);
msg.document.write(“</body></html><p>”);

// If you just want to open an existing HTML page in the 
// new window, you can replace win()’s coding above with:
// window.open(“page.html”,””,”height=200,width=200,left=80,top=80″);

}
// End –>
</script>
<!– STEP TWO: Add the last coding to the BODY of your HTML document  –>

<BODY>

<body bgcolor=”white”>

<center>
<form>
<input type=”button” value=”Open Window” onclick=”win()”>
</form>
</center>

<!– Or you may use: <a href=”javascript:win()”>Open Window</a> –>

<p><center>
<font face=”arial, helvetica” size=”-2″>Free JavaScripts provided<br>
by <a href=”https://javascriptsource.com”>The JavaScript Source</a></font>
</center><p>

Buttons

Related Snippets:

  • Scrolling Text Button
  • Random Link Generator 2

Primary Sidebar

Popular Posts

Story Generator

IP Grabber – get a users IP address with JavaScript

Simple Calendar

Remove Ads

Astrological Calculator

Copyright © 2025 JavaScriptSource.com

  • About
  • Privacy Policy
  • FAQ
  • Jobs For Developers