*********Demo.html********
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style>
tr{behavior:url(demo.htc)}
</style>
</head>
<body>
<table bgcolor="#CCCCCC" border="0">
<tr>
<td>用户ID</td>
<td>姓名</td>
<td>国别</td>
<td>省别</td>
<td>所在城市</td>
</tr>
<tr id="loopTR">
<td><input type="checkbox" id="aaaa"></td>
<td>周健</td>
<td>中国</td>
<td>江苏省</td>
<td>南京市</td>
</tr>
</table>
</form>
<script>
loopTR.onpush=function(){loopTR.changCheckBoxStatus();}
</script>
</body>
</html>
*********Demo.htc*********
<public:component>
<public:attach event="ondocumentready"
onevent="DoInit()"/>
<public:attach event="onmouseover"
onevent="MouseOver()"/>
<public:attach event="onmouseout"
onevent="MouseOut()"/>
<public:attach event="onclick"
onevent="DoClick()"/>
<public:event name="onPush" id="push"/>
<public:method name="changCheckBoxStatus"/>
<script>
var normalColor;
function DoInit()
{
normalColor=event.srcElement.parentElement.style.background;
}
function MouseOver()
{
if(event.srcElement.parentElement!=event.srcElement.parentElement.parentElement.children[0])
event.srcElement.parentElement.style.background="dimgray";
}
function MouseOut()
{
event.srcElement.parentElement.style.background=normalColor;
}
function DoClick()
{
push.fire();
}
function changCheckBoxStatus()
{
elem=event.srcElement.children[0].children[0];
if(elem.type=="checkbox")
{
if(elem.checked)
elem.checked=false;
else
elem.checked=true;
}
}
</script>
</public:component>