hi

i am trying to center a div on a page using these functions:

function topDiv(){
h = 420
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
document.write( TopPosition );
}

function leftDiv(){
w = 760
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
document.write( LeftPosition );
}

and then trying to write it to the page using:

<div style="position: absolute;
top: <script language='javascript'>topDiv();</script>px;
left: <script language='javascript'>leftDiv();</script>px;
z-index: 1;">

but it does not have any effect on the placement of my div.

any help with passing these two values to the top and left properties of my div would be much appreciated, or if there is an alternative way to place a div centrally and horizontally on the screen, i'd love to hear it.

many thanks and respect
m a r t i n