Click to See Complete Forum and Search --> : Next stage ->


chriz
07-08-2004, 03:26 AM
Hi all!, i wanted to take my javascript skills to the next stage, and i was wondering if anybody could help me learn the following types of code : How to use the X and Y co-ordinates of any ID object
Every book i look in dosn't describe this properly.
However i do use the style="pos.......;top:400;left:100" tags but when i use javascript to change the 'position' of this object it dosn't work
I do try using these codes:
document.all.id1.style.top == 10;
and
document.all.id1.style.pixelLeft == 10;
but they don't work in my IE

Thanx a lot guys!

:)

Pittimann
07-08-2004, 03:31 AM
Hi!

You cannot use '==' to assign a value (this is for equation); just use a single '=' for that. Another thing is: you should not use document.all (at least not without adding code for browsers other than IE). The reference for DOM browsers is document.getElementById('idGoesHere').

Cheers - Pit

chriz
07-08-2004, 04:09 AM
Yeah, that was a very fast script i just managed to write 'cos im in college

I do remember the one = sign it was a small mistake and i have tried the getElementById("d") method too.
as b4 not enough time yet. Talk soon