Useful Resources
syllabus | schedule | exercises | assignments | class notes | resources | students | ARTC courses
More Window Information

Opening, Sizing and Placing Window Using SELF

// keywords for monitor resolution
      screen.height
      screen.width

In the <head>: (of the document you are trying to open)

<script language="javascript" type="text/javascript">

      self.resizeTo(screen.width, screen.height); //resizes to fill monitor screen
      self.resizeTo(300, 400); //resizes to specific size

      self.moveTo(0, 0); //0,0 = upper left

</script>

// Centering the Window

<script language="javascript" type="text/javascript">

//variables to figure out position no matter the screen res
//the 300 is the width of the window and 400 is the height of the window
// this will center the window

      x = (screen.width - 300) / 2; //(screen width - window width) / 2
      y = (screen.height - 400) / 2; //(screen height - window height) / 2
      self.moveTo(x, y);

</script>

SAMPLE:

<script language="javascript" type="text/javascript">

      var h = 400; // arbitrary window height
      var w = 300; // arbitrary window width

      var x = (screen.width - w) / 2; // window position based on screen size
      var y = (screen.height - h) / 2;

      self.resizeTo(w,h); // size window
      self.moveTo(x,y); //position window

</script>

Closing Window Using SELF

In BODY: (of document you are trying to open)

      <a href="javascript:self.close();">close window </a>

[BACK to RESOURCES]