Javascript - table et appendChild
Bonjour,
j'ai le code HTML suivant (un lien qui crée et affiche un tableau dans une DIV) :
Code:
1 2 3
| <a href="#" onclick="AfficheDocXML('resa')">Afficher</a>
<div id="resa" >
</div> |
et le code Javascript suivant :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| function AfficheDocXML(resa){
ob_table = document.createElement("table");
ob_table.id = "tableauIDResa";
ob_table.setAttribute("BORDER","1");
ob_table.setAttribute("CELLPADDING","0");
ob_thead = document.createElement("THEAD");
ob_th = document.createElement("TH");
ob_titre = document.createTextNode("Date début")
ob_th.appendChild(ob_titre);
ob_thead.appendChild(ob_th);
ob_th = document.createElement("TH");
ob_titre = document.createTextNode("Date fin")
ob_th.appendChild(ob_titre);
ob_thead.appendChild(ob_th);
ob_table.appendChild(ob_thead);
} |
Sous Firefox, ça marche bien, mais sous IE, rien ne s'affiche.
Savez vous pourquoi?
Merci pour votre aide.