如何通过JavaScript函数获取Web报表单元格的值?

来源:百度知道 编辑:UC知道 时间:2024/05/30 22:30:20

<script language="JavaScript">
var i = window.document.getElementById("ids").value;
alert(i);
</script>

<input id="ids" type="text"/>

给个id 用getElementById()来获取

.....
<form name="myform" method="POST">
<table name="tbl">
<tr>
<td>NO.</td>
<td id="no"></td>
</tr>
<tr>
<td>Score</td>
<td id="score"></td>
</tr>
</table>
</form>
.....
.....
省略部分代码
下面看看JavaScript中如何得到表格中的数据
方法一:
var no = document.getElementById("no");
vat score = document.getElementById("score");
方法二:
var no = document.myform.tbl.no;
var score = document.myform.tbl.score;

<body>
<