• 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 / Page Details / Top Window

Top Window

Top Window

Use this JavaScript to keep a window ‘on top’ of the rest of your other windows. Not sure what I mean? Try it out and see!

  1. Paste the coding into the HEAD of your “opener” HTML document
  2. Copy the second coding into the BODY of your “opener” page
  3. Create your pop-up page and save it as popup-page.html
  4. Put the onBlur handler in the BODY of popup-page.html
<!– STEP ONE: Copy this code into the HEAD of your “opener” page  –>

<HEAD>

<SCRIPT LANGUAGE=”JavaScript”>

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

<!– Begin
function topWindow(){
popup = window.open(“popup-page.html”,””,”height=175,width=300,scrollbars=no”);
}
// End –>
</SCRIPT>
<!– STEP TWO: Add this code the the BODY of your “opener” page  –>

<BODY>

<CENTER>
<FORM>
<INPUT TYPE=”BUTTON” VALUE=”Pop-Up” onClick=”topWindow()”>
</FORM>
</CENTER>

<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>
<!– STEP FOUR: Add onBlur handler to BODY of popup-page.html  –>

<BODY onBlur=”self.focus()”>

<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>

Page Details

Related Snippets:

  • Notify when element size is changed
  • Viewport Width
  • Check If the Document is Ready
  • Hexadecimal Color Wheel

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