Setting the Netscape Navigator s Dimensions


Setting the Netscape Navigator's Dimensions

In the Netscape Navigator, you can resize the browser on-the-fly with the innerWidth , innerHeight , outerWidth , and outerHeight properties (see Table 7.2). Here's an example that puts these properties to work, resizing the browser as you click buttons :

(Listing 07-05.html on the web site)
 <HTML>      <HEAD>          <TITLE>Setting Window Size</TITLE>          <SCRIPT LANGUAGE="JavaScript">              <!--  var beginWidth = window.outerWidth   var beginHeight = window.outerHeight   function inner()   {   window.innerWidth = 400   window.innerHeight = 400   }   function outer()   {   window.outerWidth = 400   window.outerHeight = 400   }   function available()   {   window.outerWidth = screen.availWidth   window.outerHeight = screen.availHeight   }   function restore()   {   window.outerWidth = beginWidth   window.outerHeight = beginHeight   }  // -->          </SCRIPT>      </HEAD>      <BODY>          <H1>Setting Window Size</H1>          <BR>          <FORM>  <INPUT TYPE="button" VALUE="Set inner dimensions" onClick="inner()"><BR>   <INPUT TYPE="button" VALUE="Set outer dimensions" onClick="outer()"><BR>   <INPUT TYPE="button" VALUE="Use available space" onClick="available()"><BR>   <INPUT TYPE="button" VALUE="Restore original" onClick="restore()"><BR>  </FORM>      </BODY>  </HTML> 

You can see the results in Figure 7.5, where I'm resizing the Netscape Navigator just by clicking buttons. Note that you also can restore the browser to its original dimensions with the "Restore original" button.

Figure 7.5. Resizing the Netscape Navigator by clicking buttons.

graphics/07fig05.gif



Inside Javascript
Inside JavaScript
ISBN: 0735712859
EAN: 2147483647
Year: 2005
Pages: 492
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net