<script type="text/javascript">
function texts(a,b)
{
....
}
</script><input id="Checkbox1" type="checkbox" onclick="AdditionalRoleModPermID("","");"
onpropertychange="texts("","");" onblur="texts("","");"
onchange="texts("","");" />在页面将这个checkbox打钩的时候要触发这个texts方法 但是触发不了 上面这几个事件都触发不了
该怎么写才能进到方法里面去呢
function texts(a,b)
{
....
}
</script><input id="Checkbox1" type="checkbox" onclick="AdditionalRoleModPermID("","");"
onpropertychange="texts("","");" onblur="texts("","");"
onchange="texts("","");" />在页面将这个checkbox打钩的时候要触发这个texts方法 但是触发不了 上面这几个事件都触发不了
该怎么写才能进到方法里面去呢
<input id="Checkbox1" type="checkbox" onclick='texts("","");' />
<!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> new document </title>
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<script type="text/javascript">
<!--
function texts(a, b) {
alert(a + ":" + b);
}
//-->
</script>
</head> <body>
<input id="Checkbox1" type="checkbox" onclick='texts("1","2");' />
</body>
</html>
http://download.csdn.net/source/308916DHTML参考手册.rar
http://download.csdn.net/source/308913样式表中文手册.chm
http://download.csdn.net/source/304124
<input id="Checkbox1" type="checkbox" onclick="texts("","");"
onpropertychange="texts("","");" onblur="texts("","");"
onchange="texts("","");" />
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script type="text/javascript">
function validate(chk){
if (chk.checked == 1)
alert("Thank You");
}
</script>
</HEAD> <BODY>
<input type="checkbox" name="chk1" onclick="validate(chk1)"> test </input>
</BODY>
</HTML>
var chk = document.getElementById("chk1");
easy, L@_@K again<!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> new document </title>
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<script type="text/javascript">
<!--
function texts(target, a, b) {
if (target.checked)
alert(a + ":" + b);
}
//-->
</script>
</head> <body>
<input id="Checkbox1" type="checkbox" onclick='texts(this, "1","2");' />
</body>
</html>
if (chk.checked == 1)
alert("Thank You");
}
如果 input 没有 id 或 name 属性的话,这段无法正确执行,
此外,chk.checked == 1 是画蛇添足,chk.checked 就可以了,
即使要比较也应该是 chk.checked == true,等于 1 完全是不会偷懒还瞎偷懒!
chk.checked == true你说的对,但我定义选中时为1也就是true,未选中时为0就是false,有何不妥?
技术是无界限的,不要只想着你的对,或许你很厉害但也不要排斥别人