<table width="100%" border="0" cellspacing="0" cellpadding="0" id="l">
<tr id="11">
<td>222</td>
<td>333</td>
<td id="power">444</td>
</tr>
</table>
<script>
function getValue()
{
alert(document.getElementById("l").innerText);
}
</script>
<button onclick=getValue()>get value</button
<tr id="11">
<td>222</td>
<td>333</td>
<td id="power">444</td>
</tr>
</table>
<script>
function getValue()
{
alert(document.getElementById("l").innerText);
}
</script>
<button onclick=getValue()>get value</button
<tr id="11">
<td>222</td>
<td>333</td>
<td id="power">444</td>
</tr>
</table>
<script>
function getValue()
{
alert(document.getElementById("l").innerText);
}
</script>
<button onclick=getValue()>get value</button>
少了一个>呵呵,不好意思。
<head>
<script>
function a(){alert(document.all.q1.rows[0].cells[0].innerText);}
</script>
</head><body>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="q1">
<tr id="11">
<td>222</td>
<td>333</td>
<td id="power">444</td>
</tr>
</table>
<br>
<input type="button" name="s" onClick="a()" value="点我">
</body>
</html>这个也许有另种用途
<html>
<head>
<script>
function a(){
var c;
c=event.srcElement.innerText;
alert(c);
//alert(document.all.q1.rows[0].cells[0].innerText);}
</script>
</head><body>
<table width="100%" border="1" cellspacing="0" cellpadding="0" id="q1" onClick="a()">
<tr id="11">
<td>222</td>
<td>333</td>
<td id="power">444</td>
</tr>
</table>
<br>
</body>
</html>
<tr id="11">
<td>222</td>
<td>333</td>
<td id="power">444</td>
</tr>
</table>
<script>
function getValue()
{
alert(document.getElementById("power").innerText);
}
</script>
<button onclick=getValue()>get value</button>
<tr id="11">
<td>222</td>
<td>333</td>
<td>444</td>
</tr>
</table>
<script>
var tb = document.getElementById('1');
for (var i=0;i<tb.rows.length;i++) {
for (var j=0;j<tb.rows[i].cells.length;j++) {
alert(tb.rows[i].cells[j].innerText)
}
}
</script>
<head>
<title>wanghr100</title>
<script>function getText(n) {
if(n.nodeType==3)
return n.data;
var alltext="";
for(var m=n.firstChild;m!=null;m=m.nextSibling) {
alltext+=getText(m);
}
return alltext;
}</script>
</head>
<body>
<input type=button onClick="alert(getText(document.getElementById('1')));" value="get">
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="1">
<tr id="11">
<td>222</td>
<td>333</td>
<td id="power">444</td>
</tr>
</table>
</body>
<input type=button onClick="alert(getText(document.getElementById('power')));" value="get">