Premetto che ho già letto le guide su javascript e DOM presenti in questo sito.
Ho un il seguente codice HTML
ed il seguente codice javascript:<html>
<head>
<title>Pagina di Prova</title>
<script type="text/javascript" src="/home/savio/Scrivania/prova.js"></script>
</head>
<body>
<h1 align="center">PROVA DI RIMOZIONE DI RIGHE E CELLE DALLA TABELLA</h1>
<table id="nometabella" border="2" align="center" cellpadding="10%">
<tr id="nomeriga1"><td>Cella 1</td><td>Cella 2</td></tr>
<tr id="nomeriga2"><td>Cella 3</td><td>Cella 4</td></tr>
<tr id="nomeriga3"><td>Cella 5</td><td>Cella 6</td></tr>
</table>
<input type="submit" value="Enter" onclick="return del()"/>
</body>
</html>
Voglio cancellare la prima riga della tabella, ma non succede niente.function del() {
if (document.getElementById) {
var tabella = document.getElementById("nometabella");
var riga1 = document.getElementById("nomeriga1")
tabella.removeChild(riga1);
}
}
Qual'è il problema?