11548 sujets

JavaScript, DOM et API Web HTML5

Bonsoir,

J'ai un table qui contient plusieurs tbody.

Un de ces tbody a l'id "co_author"

<tbody id="co_author">


Dans ce Tobdy, j'aimerais insérer 3 zones de textes, j'appelle donc sur le clic d'un bouton une fonction nommée Add_Co_Author.

<td><input type="button" value="Add CO-AUTHOR" onClick="Add_Co_Author();"></td>


Voici le code de ma fonction :

function Add_Co_Author()
{
	if(global_numero_auteur < 13)
	{
		document.getElementById('co_author').innerHTML+= '<tr><td class="important">CO-AUTHOR '+global_numero_auteur+'</td></tr><tr><td>FIRST NAME<span class="asterix">*</span></td><td align="left"><input type="text" size="50"></td></tr><tr><td>LAST NAME<span class="asterix">*</span></td><td align="left"><input type="text" size="50"></td></tr><tr><td>INSTITUTION/AFFILIATION<span class="asterix">*</span></td><td align="left"><input type="text" size="50" onfocus="this.style.backgroundColor=\'yellow\'" onblur="this.style.backgroundColor=\'white\'"></td></tr>';
	}
	
	global_numero_auteur+=1;
}


J'arrive dans la fonction, global_numero_auteur vaut 4 quand j'arrive dans la fonction (je l'ai vérifié par une alerte).

Le problème doit venir du innerHTML.

Auriez-vous une autre solution fonctionnant avec IE ?

En tout cas, avec Firefox, cela fonctionne parfaitement.

Merci d'avance.

beegees