<html>
<head>
<script language="javascript">
function td_Capture(td_value)
{
var td_value;
td_value = document.getElementById("td1");
alert(td_value.innerHTML);
}
</script>
</head>
<body>
<table border="1">
<tr>
<td id="td1" onclick="td_Capture()">this is td's value</td>
</tr>
</table>
</body>
</html>
<head>
<script language="javascript">
function td_Capture(td_value)
{
var td_value;
td_value = document.getElementById("td1");
alert(td_value.innerHTML);
}
</script>
</head>
<body>
<table border="1">
<tr>
<td id="td1" onclick="td_Capture()">this is td's value</td>
</tr>
</table>
</body>
</html>
解决方案 »
- 为什么 window.open()指定在某个iframe打开,只能执行一次
- 求求高手赶快来解决,能逼疯~~~!!在线等啊~~
- 本地服务器生成的cookie文件放在哪了?
- 网站静态化策略
- 阿里放入购物车问题
- 如何对两个文本框内容比较
- 我用javascript计算出来的值怎么放在网页上 急!!!!!!
- 怎么样弹出一个没有ie边框、工具栏...滚动条的窗口,不是全屏窗口?
- 关于input的一个效果的问题。
- 请各位大神看一下为什么reg_msg没有定义
- xml没有换行与空格,firefox 下,javascript读取不到内容
- 非常奇怪的问题,Javascript在localhost调试通过, 放到服务器就不行!!
<head>
<script language="javascript">
function td_Capture(td_value)
{
var td_value;
td_value = document.getElementById(td_value);
alert(td_value.innerHTML);
}
</script>
</head>
<body>
<table border="1">
<tr>
<td id='td1' onclick="td_Capture('td1')" bgcolor="#cccccc">this is Father's value</td>
</tr>
<tr>
<td id='td2' onclick="td_Capture('td1')">this is td's value</td>
</tr>
<tr>
<td id='td3' onclick="td_Capture('td1')">this is td's value</td>
</tr>
</table>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script src="select.js" type="text/javascript" language="javascript"></script>
</head><body>
<form method="post" action="save.jsp">
<table cellspacing="0" cellpadding="1" border="1">
<tr>
<td>depth </td> <td>A </td> <td>B </td>
</tr>
<tr>
<td>200 </td> <td onclick="getvalue(this)">-2 </td> <td onclick="getvalue(this)">2 </td>
</tr>
<tr>
<td>300 </td> <td onclick="getvalue(this)">-3 </td> <td onclick="getvalue(this)">3 </td>
</tr>
<tr>
<td>400 </td> <td onclick="getvalue(this)">-4 </td> <td onclick="getvalue(this)">4 </td>
</tr> </table> 当前值:<input type="text" id=mytext name="mytext" /> <br/>
对应属性是:<input type="text" id="t" name="t"/><br/>
深度:<input type="text" id="depth" name="depth"/><br/><script>
function getvalue(o){
document.getElementById("mytext").value = o.innerHTML
//alert(parentNode.firstChild.innerHTML);//取的后可以做其他用.
//var deep=parentNode.firstChild.innerHTML ;
document.getElementById("depth").value=o.parentNode.cells[0].innerHTML;
}
</script><input type="submit" value="submit"/>
</form>
</body>
</html>我只完成了一部分
function getvalue(o){
document.getElementById("mytext").value = o.innerHTML
//alert(parentNode.firstChild.innerHTML);//取的后可以做其他用.
//var deep=parentNode.firstChild.innerHTML ;
document.getElementById("depth").value=o.parentNode.cells[0].innerHTML;
document.getElementById("t").value=o.parentElement.parentElement.rows[0].cells[event.srcElement.cellIndex].innerHTML;
//document.getElementById("t").value=o.rows[0].innerHTML;}
</script>[