当我们点击一行时,我想得到一个表的选定行值,我该怎么做?
答案 0 :(得分:1)
<script type="text/javascript">
window.onload=function() {
var table = document.getElementById("table1");
var tablerows = table.rows;
for (var i=0, n=tablerows.length;i<n;i++) {
tablerows[i].onclick=function() {
alert(tablerows[i].textContent?tablerows[i].textContent:tablerows[i].innerText)
}
}
}
</script>