molily: DOM elemente in IE

Beitrag lesen

Hallo,

element_datestart = document.createElement("input");
element_datestart.setAttribute("name", "datestart");
element_datestart.setAttribute("maxlength", "10");
element_datestart.setAttribute("class", "seasondatefield");
element_datestart.setAttribute("style", "width: 128px; float: left; height: 16px; margin: 0 20px 0 0;");

Vermeide setAttribute, setze die Eigenschaften direkt:

element_datestart.name = "datestart";
element_datestart.maxlength = 10;

Bei class musst du className verwenden:

element_datestart.className = "seasondatefield";

Mehrere style-Angaben kannst du so setzen:

element_datestart.style.cssText = "width: 128px; float: left; height: 16px; margin: 0 20px 0 0;";

Mathias