Forum Moderators: not2easy

Message Too Old, No Replies

Moving a div in Netscape

Code for moving a div in Netscape

         

Adam5000

9:16 am on Feb 23, 2006 (gmt 0)

10+ Year Member



Thanks to everyone who has helped. You're doing a great job and you're all fabulous.
What I'm trying to do now, is move a div left and right, up and down, when the page is viewed with the Netscape browser. I think the way to do this differs a little between MSIE and Netscape, but I'm not sure. And I think the code below is close. Help!

<html>
<head>
<title>Move div Netscape</title>
</head>

<body>
<div id="netscape1" style="position:absolute; top:100; left:100;">
<img src="picture 3.jpg">
</div>
<script language="javascript">
window.document.netscape1.left = window.document.netscape1.left +300;
</script>
</body>
</html>

xfinx

12:01 pm on Feb 24, 2006 (gmt 0)

10+ Year Member



I think you should ask this question to some JS nerds instead of CSS nerds ;-)

Robin_reala

12:47 pm on Feb 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For what it's worth you can't address an id'ed element directly, you'll have to use getElementById(). Next, you'll need to reference element.style.left, not just element.left. Also, you'll find that Gecko requires pixel values to have a 'px' suffix so remember to add that on before setting.

Adam5000

8:48 am on Feb 25, 2006 (gmt 0)

10+ Year Member



Thank you X and Robin. The page works fine when viewed with MSIE, but getting it to work with the Netscape browser is a challenge. I'm going to give it a rest for a few days.