...

View Full Version : Making it work in netscape!



Crash1hd
01-18-2003, 06:19 AM
Ok I have a script that I want to use to make a div tag show in the dead center of the page works great in IE! but of course like everything else it doesnt work in netscape :) here is the script!


<SCRIPT>
function fnInit() {

if(ie){DivID.style.setExpression("left", "document.body.clientWidth/2 - Welcome.offsetWidth/2");} if(ns){Welcome.setExpression("left", "innerWidth/2 - DivID.offsetWidth/2");}
if(ie){DivID.style.setExpression("top", "document.body.clientHeight/2 - Welcome.offsetHeight/2");} if(ns){Welcome.setExpression("top", "innerHeight/2 - DivID.offsetWidth/2");}

}
onlOad=fnInit
</SCRIPT>

<div id="DivID" style="position:absolute;visibility:hidden">

document body content

</div>

so what do I replace the offsetWidth and the offsetHeight with for netscape? also what would work for the setExpression as the error I get in netscape is DivID is not defined.

Crash1hd
01-18-2003, 08:07 AM
SO how Would I go About Defining the DivID?

Algorithm
01-18-2003, 09:54 AM
Whenever you reference a div, you should do it like this:

document.getElementById("DivID")

This method is supported in just about every version 5 browser.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum