Javascript遍历Html Table(包括内容和 属性值)
1: 遍历并输出Table中值
<table id="tb">
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
</table>
function f()
{
var t=document.getElementById("tb").childNodes.item(0);
for(var i=0;i< t.childNodes.length;i++)
{
for(var j=0;j<t.childNodes(i).childNodes.length;j++)
{
alert(t.childNodes(i).childNodes(j).innerText);
}
}
}
2: 遍历Table,读取CheckBox状态和其他Column值
<!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>
<title>Untitled Page</title>
</head>
<body onload="f()">
<script type="text/javascript">
function f()
{
var t=document.getElementById("tb").childNodes.item(0);
for(var i=0;i< t.childNodes.length;i++)
{
alert(t.childNodes(i).firstChild.firstChild.nodeValue);
alert(t.childN
相关文档:
<script >
function showimage()
{
//IMG1为图片控件或Div,File1为上传文件控件
document.getElementById("IMG1"). src = document.getElementById("File1").value;
}
</script >
控件中引用:
<input id="File1" runat="server" type="file" onc ......
<script type="text/javascript">
function dayChange(year,month,day){
var selectYear = document.getElementById(year);
var selectMonth = document.getElementById(month);
var selectDay = document.getElementById(day);
va ......
String.prototype.HTMLEncode = function() {
var temp = document.createElement ("div");
(temp.textContent != null) ? (temp.textContent = this) : (temp.innerText = this);
var output = temp.innerHTML;
temp = null;
return output;
}
String.prototype.HTMLDecode = function() {
var temp = doc ......
JavaScript API
One of the new features we added to the ASP.Net Report Viewer in Visual Studio 2010 is a JavaScript API to allow you to interact with the viewer on client. In reading many of the posts on the report controls forum, we found that many people struggle when implementing a custom ......
平时我们有可能遇到需要把网站中的数字(通常是价格)用一种统一的方式显示出来,比如每隔3个字符加一个空格。如果数值比较大的话这种方法很有利于用户阅读。
用XSLT的朋友可能知道在XSL中可以用如下代码实现
<xsl:decimal-format name="currency" decimal-separator="." grouping-separator=" "/>
今天研究了一下 ......