Originariamente inviato da homezappa
Fatto!
Un consiglio: indenta il codice!
codice:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Gestione DOM</title>
<style type="text/css">
<!--
.normal1 {font-family:tahoma;font-size:8pt;background-color:yellow}
.normal2 {font-family:tahoma;font-size:8pt;background-color:white}
.overTR {font-family:tahoma;font-size:8pt;background-color:blue;color:white}
.clicked {font-family:tahoma;font-size:8pt;background-color:red;color:white}
-->
</style>
<script language="JavaScript" type="text/javascript">
<!--
var aTR = null;
var aTD = null;
var aTbody = null;
function colore_celle() {
    if(document.getElementById && document.getElementsByTagName) {
        var righe = document.getElementsByTagName("tr");
        cont=0;
        for(i=0; i < righe.length; i++) {
            if (cont==0){
                righe[i].className='normal1';
                cont=1;
            }else{
                righe[i].className='normal2';
                cont=0;
            }
        }
    }
}
function selectRow(aTD) {
    colore_celle();
    if (aTD.tagName == 'TD') {
        aTR = aTD.parentElement ? aTD.parentElement : aTD.parentNode;
        aTR.className='clicked';
        aTbody = aTR.parentElement ? aTR.parentElement : aTR.parentNode;
        document.getElementById('canc').disabled = false;
    } 
} 

function _deleteRow(aTD) {
    if (aTR != null) {
        aTbody.deleteRow(aTR.rowIndex);
        aTR = null;
        aTbody = null;
        document.getElementById('canc').disabled = true;
    } else {
        alert('Cliccare la riga da cancellare');
    } 
} 

function action(e) {
    if (window.event) e=window.event; 
    var srcEl = e.srcElement? e.srcElement : e.target;
    selectRow(srcEl);
}

//-->
</script>


</head>
<body>
<table summary="" cellpadding="0" onclick="action(event);">
<tr class="normal1" >
<td>AAAAAAAAAAAAAAAAAAAAA</td>
<td>AAAAAAAAAAAAAAAAAAAAA</td>
<td>AAAAAAAAAAAAAAAAAAAAA</td>
<td>AAAAAAAAAAAAAAAAAAAAA</td>
</tr>
<tr class="normal2" >
<td>BBBBBBBBBBBBBBBBBBBBB</td>
<td>AAAAAAAAAAAAAAAAAAAAA</td>
<td>AAAAAAAAAAAAAAAAAAAAA</td>
<td>AAAAAAAAAAAAAAAAAAAAA</td>
</tr>
<tr class="normal1" >
<td>CCCCCCCCCCCCCCCCCCCCC</td>
<td>AAAAAAAAAAAAAAAAAAAAA</td>
<td>AAAAAAAAAAAAAAAAAAAAA</td>
<td>AAAAAAAAAAAAAAAAAAAAA</td>
</tr>
<tr class="normal2" >
<td>DDDDDDDDDDDDDDDDDDDDD</td>
<td>AAAAAAAAAAAAAAAAAAAAA</td>
<td>AAAAAAAAAAAAAAAAAAAAA</td>
<td>AAAAAAAAAAAAAAAAAAAAA</td>
</tr>
</table>


<span style="font-family:tahoma;font-size:8pt">cliccare su una riga per attivare il bottone</style>

<input type="button" value="Cancella Riga" id="canc" disabled onclick="_deleteRow()">

</body>
</html>
Provato su:
Firefox 2.0.0.14
IE 7
IE 6
IE 5.5
Opera 9.26

... ho finito i browsers!


HTH
Zappa
Ottimo funziona davvero!

Grazie.