This works fine in IE, but not Firefox. I am trying to set the left property of an element. I can do it fine if I set it using a string literal, but not if I use offsetWidth of another element. See below.
//el is my element
//this works fine
el.style.left = "100px";
//this does not work
this.element.style.left = anotherEl.offsetWidth + "px";
Now the wierd thing is that if I run:
alert(anotherEl.offsetWidth + "px");
it displays "100px" as you would expect. Why isn't this working?
I am thinking that it has to do something with string literals or the need for a wrapper class, but can't get any combination of eval and String to work.
Any ideas?
//el is my element
//this works fine
el.style.left = "100px";
//this does not work
this.element.style.left = anotherEl.offsetWidth + "px";
Now the wierd thing is that if I run:
alert(anotherEl.offsetWidth + "px");
it displays "100px" as you would expect. Why isn't this working?
I am thinking that it has to do something with string literals or the need for a wrapper class, but can't get any combination of eval and String to work.
Any ideas?