JavaScript控制CheckBoxList单选两种方法
方法1:
1function CheckSelect()
2 {
3 var tb = document.getElementById("ctl00_ContentPlaceHolder1_chkYear");
4
5 for(var i=0;i < tb.rows.length;i++)
6 {
7 var chk = tb.rows[i].firstChild.firstChild;
8 alert(chk == event.srcElement);
9 if(chk != event.srcElement)
10 { chk.checked = false;}
11 }
12 }
此方法适用在竖向排列情况下。
方法2:
1function CheckSelect()
2 {
3 var tb = document.getElementById("CheckBoxList1");
4 for(var i=0;i < tb.rows.length;i++)
5 {
6 for(var j =0; j < tb.rows[i].cells.length; j++)
7 {
8 var chk = tb.rows[i].cells[j].firstChild;
9 if(chk!= null && chk != event.srcElement)  
相关文档:
JavaScript是基于对象的,任何元素都可以看成对象。然而,类型和对象是不同的。本文中,我们除了讨论类型和对象的一些特点之外,更重要的是研究如何写出好的并且利于重用的类型。毕竟,JavaScript这种流行的脚本语言如果能够进行良好的封装,并形成一个庞大的类型库,对于重用是非常有意义的。
网上对于prototype的文章很 ......
在javascript中得到当前窗口的高和宽
<body><SCRIPT LANGUAGE="JavaScript">
var s = "";
s += "\r\n网页可见区域宽:"+ document.body.clientWidth;
s += "\r\n网页可见区域高:"+ document.body.clien ......
JSON:
[{"subjecttypeId":"1","subjectName":"67","scope":"1",},{"subjecttypeId":"1","subjectName":"345","scope":"1"}]
JavaScript:
var result = window.eval('(' + JSON+ ')');
for(var p in result){
result[p].subjectName;
alert(result[p] ......
1 history.go(0)
2 location.reload() (页面进行刷新,但为disabled的元素的值不会被清空)
3 location=location
4 location.assign(location)
5 location.replace(location)
6 from..reset() (页面不进行刷新,模拟单击对所调用表单重置按钮的单击)
......
<html>
<body>
<mce:script type="text/javascript"><!--
document.write("<table border=1px>");
for(i=1;i<=9;i++)
{document.write("<tr>");
for (j=1;j<=i;j++)
{document.write("<td class='table1'>"+i+"*"+j+"="+i*j+" & ......