Ich versuche, auf eine Zeile html klicken und alle Elemente, aber ich kann es nicht herausfinden, unten sind meine HTML Land Java Script Codes, Hilfe!Wählen Sie Html Zeile und erhalten Sie ausgewählte Daten
<table id="example"width="100%" border="1" cellpadding="0" cellspacing="0">
<tr id="1"onmouseover="ChangeColor(this, true);" onmouseout="ChangeColor(this, false);" onclick="readvalues();">
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr id="2"onmouseover="ChangeColor(this, true);" onmouseout="ChangeColor(this, false);" onclick="readvalues();">
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
<tr id="3"onmouseover="ChangeColor(this, true);" onmouseout="ChangeColor(this, false);" onclick="readvalues();">
<td>7</td>
<td>8</td>
<td>9</td>
</tr>
</table>
Und mein Javascript-Codes
<script type="text/javascript">
function ChangeColor(tableRow, highLight) {
if (highLight) {
tableRow.style.backgroundColor = '#dcfac9';
} else {
tableRow.style.backgroundColor = 'white';
}
}
</script>
möchten Sie tr Element auf klicken? – Nitesh
Sie haben nicht die Funktion readvalues in Javascript und welches Element möchten Sie besonders? für diese Zeile oder alle Elemente? – Ankit
@Nitesh Ja, das ist, was ich tun wollte, aber es ist jetzt gelöst – Rookie