<b>REGISTER</b>

GFX-Sector - Javascript & jQuery


 
GFX-Sector » Coding Area » Webentwicklung » Javascript & jQuery » [javascript] string zuweisung bei css » Hello Guest [Login|Register]
Last Post | First Unread Post Print Page | Recommend to a Friend | Add Thread to Favorites

Javascript & jQuery

Probleme, Fragen oder sonstiges mit JavaScript, jQuery und co? Hier bist du richtig!
Post New Thread Post Reply

[javascript] string zuweisung bei css

     Deutsche Version  English version
Author
Post « Previous Thread | Next Thread »

Mero Mero is a male
The Dreadworks Project

Spender


Avatar von Mero

Registration Date: 12.11.2006
Posts: 3,294
Location: Weserbergland
Program: Photoshop, Illustrator, Notepad++
Deviantart: dreadworks

Spacer
[javascript] string zuweisung bei css

[javascript] string zuweisung bei css

      

moin,

ich hab da folgendes problem:

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

[javascript] string zuweisung bei css 21.08.2008 18:02 Mero is offline Homepage of Mero Search for Posts by Mero
 
Spacer
   
GFX-Sector
unregistered


 hat kein Avatar


Spacer

Have you enjoyed this topic?


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.)

New Post 21.08.2008 18:02  
Tree Structure | Board Structure
Post New Thread Post Reply
GFX-Sector » Coding Area » Webentwicklung » Javascript & jQuery » [javascript] string zuweisung bei css

Similar topics to [javascript] string zuweisung bei css
Thread
[Guter Anfänger] ? Lelouch überarbeitet (Forum: Signaturen/Avatare)
[Multimedianews] Klarnamenzwang bei WoW, Facebook verdirbt Sitten (Forum: World & Hightech News)
[Guter Anfänger] Pause vorbei :D (Forum: Signaturen/Avatare)
Viele Drogen, Party und dann Nudeln beim China (Forum: Signaturen/Avatare)
CSS Clanpaket gesucht (Forum: Archiv)