ich möchte die vertikale position eines objektes ändern. das geht so:
var meinObjekt = document.getElementById('IDmeinesObjektes');
function funktionsName() { meinObjekt.style.top = "120px"; };
soweit geht alles. wichtig ist halt, dass die 120px als string übergeben werden.
jetzt kommt mein problem:
ich möchte, dass eine numerische variable
zB. y = 120;
übergeben wird. ich dachte, da javascript strings + zahlen immer in strings umwandelt, könnte ich das so machen:
function funktionsName() { meinObjekt.style.top = "'"+ y + "px'"; };
( weil mans schlecht lesen kann, so: " ' " + y + " px ' " )
...also die variable y einfach einfügen.
funktioniert leider nicht.
edit: habs gelöst:
"'"+ y + "px'";
ist totaler unsinn, weil:
y + "px"
macht genau das was ich will und funktioniert...
.
The Dreadworks Project And in my darkest moment, fetal and weeping
The moon tells me a secret - my confidant
As full and bright as I am
This light is not my own and
A million light reflections pass over me
If you were enjoying this post and if you keen on reading more interesting stuff then do not hesitate to complete the free sign up.
After the free registration you will gain access to all areas and you will be able to communicate with other artists from all over the world.
In addition you will benefit from our Photoshop and coding section as well as from our huge (hundreds of gigabytes) free resource section where you can find everything you will need to be a successful (web) designer/artist.
Sign up now and enjoy the advantages as a registered member.
(This website will be ad-free after a complete free sign up.)