KC You are exactly right!
But to make things a bit more easy you can put it in a function, like
so:
function changePosition(id,posType,x,y){
var obj = document.getElementById(id);
obj.style.position = posType;
obj.style.left = x;
obj.style.top = y;
}
Now you can use this function everytime you want to do a change like
this bij calling the function: example:
<div onclick="changePosition(this,'absolute', '-100px', '0px')">
this should work as well and might make things a bit more handy.
Yorian
KC wrote:
I'm new to JavaScript, but I think you can do something like this:
var obj=document.getElementById("changeme");
obj.style.position = 'relative';
obj.style.top = '-100px';
KC
applegree...@gmail.com wrote:
Hi, can someone please show me how to set the following conditions for
this DIV tag?
<div style="position:absolute;left:0px; top:0px;" id="changeme">HELLO
WORLD</div>
I want to be able to change the position to 'relative' and the top
position to negative '-100px' with javascript
Thank you! :))