Description:
This JavaScript lets you determine the size and position of a pop up window, as well as the contents.
JavaScript Functions: <SCRIPT LANGUAGE="JavaScript"> <!-- 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>200 pixels from left & top</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"); } function win2() { msg=window.open("","msg","height=200,width=200,left=300,top=100"); msg.document.write("<html><title>Windows!</title>"); msg.document.write("<body bgcolor='white' onblur=window.close()>"); msg.document.write("<center>300 pixels from left & 100 pixels from top</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=300,top=100"); } function win3() { msg=window.open("","msg","height=200,width=200,left=400,top=50"); msg.document.write("<html><title>Windows!</title>"); msg.document.write("<body bgcolor='white' onblur=window.close()>"); msg.document.write("<center>400 pixels from left & 50 pixels from top</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=400,top=50"); } // End --> </script>
HTML Script: <table width=420> <tr> <td align=center> <form> <input type="button" value="Window: 200 pixels from left & top" onclick="win()"> </form> <form> <input type="button" value="Window: 300 pixels from left & 100 pixels from top" onclick="win2()"> </form> <form> <input type="button" value="Window: 400 pixels from left & 50 pixels from top" onclick="win3()"> </form> </td> </tr> </table>