i am trying to center a div on a page using these functions:
h = 420
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
document.write( TopPosition );
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;
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