Box in Lower Left of Window

[Total: 0    Average: 0/5]

This example puts a box in the lower left of the browser window.

Head Code:

<SCRIPT type=text/javascript>
function suppressErrors() { return true; }
if (parseInt(navigator.appVersion) < 4) {
alert("This program requires a version 4 browser!");
onerror = suppressErrors;
}
</SCRIPT>
<script src="http://www.js-examples.com/bin/div_construct2.js"></script>
<SCRIPT type=text/javascript>

var msg2 = '<H1 STYLE="color:red;font-size:12pt;border-style:solid;width:80;height:80;clip:rect(0,80,80,0)"><TABLE ALIGN=CENTER HEIGHT="100%"><tr><td valign=middle>TEXT</td></tr></table></H1>'
var div2 = new NewDiv2(window, "d2", msg2, 100, 200,0,0,"ABSOLUTE");
</SCRIPT>

Body Code:

<script type=text/javascript>
div2.output();
function getWindowWidth() {
if (document.layers) return(window.innerWidth);
if (document.all & parseInt(navigator.appVersion) < 5) return(400);
if (document.all) return(document.body.clientWidth);
return(400);
}

function getWindowHeight() {
if (document.layers) return(window.innerHeight);
if (document.all) return(document.body.clientHeight);
return(600);
}
function moveIt() {
  var _w = getWindowWidth();
      _w = 5; // left side
  var _h = getWindowHeight();
      _h -= 95; // height of box
	  alert(_w+"n"+_h);
  div2.moveTo(_w,_h);
}
</SCRIPT>
<a href="javascript:moveIt()">click here to move it</a>
[normally the moveIt() function would be placed into your body tag onload event
onload="moveIt()"]<BR>
Do you see the box on the lower left of the window?

Times Viewed: 0

Leave a Reply

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