Open New Window With Size Based On Form Button

[Total: 0    Average: 0/5]

This shows how to have form buttons choose the size of a new window. You press a button, and tada! the window opens with that specification.

Head Code:

<script type=text/javascript>
function _newHTML(_win,t) {;
function makeWindow(x,y,t) {
  var _i = "toolbar=yes,status=yes,scrollbars=yes,location=yes,menubar=yes,directories=yes";
  var _w = "width=";
  var _h = "height=";
  var _window ='', t , _i+_w+x+','+_h+y)
function regular()          {makeWindow(600,400,"600x400"   );}
function large()            {makeWindow(800,600,"800x600"   );}
function smallmacdefault()  {makeWindow(470,300,"Mac_Small" );}
function smallpcdefault()   {makeWindow(580,300,"PC_Small"  );}
function mediummacdefault() {makeWindow(470,430,"Mac_Medium");}
function mediumpcdefault()  {makeWindow(580,430,"PC_Medium" );}
function largemacdefault()  {makeWindow(470,600,"Mac_Large" );}
function largepcdefault()   {makeWindow(580,600,"PC_Large"  );}

Body Code:

<tr><td align=center colspan=2>Open New Window With These Dimensions</td></tr>
<td align=center><INPUT TYPE=BUTTON VALUE="640x480" onClick="regular()"></td>
<td align=center><INPUT TYPE=BUTTON VALUE="800x600" onClick="large()"></td>
<tr><td></td><td align=center colspan=2>Default Netscape Browser sizes:</td></tr>
<tr><td><B>640 x 480</B></td>
<td><INPUT TYPE=BUTTON VALUE="Mac 470x300" onClick="smallmacdefault()"></td>
<td><INPUT TYPE=BUTTON VALUE="PC 580x300" onClick="smallpcdefault()"></td>
<tr><td><B>800 x 600</B></td>
<td><INPUT TYPE=BUTTON VALUE="Mac 470x430" onClick="mediummacdefault()"></td>
<td><INPUT TYPE=BUTTON VALUE="PC 580x430" onClick="mediumpcdefault()"></td>
<tr><td><B>1024 x 768</B></td>
<td><INPUT TYPE=BUTTON VALUE="Mac 470x600" onClick="largemacdefault()"></td>
<td><INPUT TYPE=BUTTON VALUE="PC 580x600" onClick="largepcdefault()"></td>
Close this Window: 

Times Viewed: 5

Leave a Reply

Your email address will not be published. Required fields are marked *