Aktion “Stoppt die Vorratsdatenspeicherung”

Willst du auch bei der Aktion teilnehmen? Hier findest du alle relevanten Infos und Materialien:
Monday, 27. August 2007 - 18:00

DOM: className in Internet Explorer [Update]

Dieser Beitrag ist auch in deutsch verfügbar (empfohlen).

Just a note for me, because I'm always taken in by this:

document.getElementById("myElement").setAttribute("class","myClass"); //will not work in IE
document.getElementById("myElement").className="myClass"; //will work in IE, too.

Update: Found a fault and corrected it. See comments.

Filed under: Webdev
Technorati Tags:
Last update of this entry was at: Friday, 26. October 2007 - 13:42


  1. Rene Drescher-Hackel (Website) wrote at 26/10/07 - 11:31:33
    document.getElementById("myElement"(Smiley: wink).setAttribute("class","myClass"(Smiley: wink);

    denn das Attribute, welches gesetzt wird heißt ja "class".

  2. Philipp Söhnlein (Website) wrote at 26/10/07 - 13:44:00
    Ja, ne, is klar.
    Hab es korrigiert.
    Trotzdem sollte man im IE wohl besser direkt .className verwenden.

  3. Andrew wrote at 25/02/09 - 16:09:48
    Your page has an XML parsing error, you missing the semi-colon on a character entity:

    XML Parsing Error: not well-formed
    Location: http://geeks-have-feelings-too.net/dom-classname-in-internet-explorer/
    Line Number 125, Column 78: document.getElementById("myElement&quot.setAttribute("class","myClass"denn das Attribute, welches gesetzt wird hei&sz

Comment entry

Commenting isn't available anymore.


What's trackback?

A trackback is a kind of a source link. If i was finding an interesting entry in another blog, that i am commenting in my own blog, i am linking to the original message via the trackback. Has someone commented one of my entries in his/her weblog, you can find this link here under trackbacks, too. More informations about trackback are in the Wikipedia for example.

Trackback URL: /trackback/dom-classname-in-internet-explorer/

Trackbacks aren't available anymore.

There are no trackbacks for this entry.


Recent acoustic enchantment

Clare Burson - Love Me In The Morning

Random Thought

No RISC, no fun! - Neo (planet3dnow.de forum)

Change the emotion

Firefox Add to Technorati Favorites