Hallo Leute,
ich bin im Fachgebiet JavaScript wirklich nicht gebildet.
Ich versuche mit JavaScript eine Tabelle mit Inhalt zu erstellen.
Ich habe mittlerweile viel gelesen und viel getestet aber ich verzweifle grade.
Script
<script type="text/javascript">
var zahl=0;
function neuerRaum() {
zahl=zahl+1;
var table = document.getElementById('newRoom');
var newRowHTML = '<tr><td width="400" align="left" valign="top">Viel Inhalt und auch die Ausgabe mit Zahl+, funktioniert auch, nur nicht im IE</td></tr>';
table = table.getElementsByTagName('tbody')[0] || table;
var newRow = document.createElement('thead');
newRow.setAttribute("width", "100%");
//newRow.setAttribute("border", "1");
//newRow.setAttribute("cellpadding", "7");
//newRow.setAttribute("cellspacing", "1");
//newRow.setAttribute("bgcolor", "#ccc");
newRow.innerHTML = newRowHTML;
table.appendChild(newRow);
}
</script>
Button und Tabelle
<input type="button" name="newRoom" onClick="neuerRaum()" value="hinzufügen" class="inputButton">
<table width="650" border="1" align="center" cellpadding="7" cellspacing="1" bgcolor="#CCCCCC">
<tbody id="newRoom">
</tbody>
</table>
Was muss ich machen damit das auch im IE funktioniert?
Ich habe viel von tbody und thead gelesen und hab das auch nach gutem Gewissen berücksichtigt...
Aber ich bekomme es nicht zum laufen!
Ich bedanke mich für eure Hilfe!