Voila un code qui devrai faire ton bonheur
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
<html>
<head>
<script type="text/javascript">
function retourneValeur(id)
{
alert(document.getElementById(id).firstChild.nodeValue);
}
</script>
</head>
<body>
<table>
<tr>
<td></td>
<td id="test">Valeur du noeud</td>
<TR>
</table>
<input type=button onclick="retourneValeur('test');" value="AFFICHER LA VALEUR DU NOEUD">
</body>
</html> |
en fait ta valeur n est pas stocke dans td mais dans ce qu on appelle un textnode qui est le fils de ton td
Pour ton code sa devrait etre
remplcer ca
par
idauteur = sel.firstChild.nodeValue;
Partager