日期:2014-05-16 浏览次数:20374 次
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
input {
background: #CCC;
}
.active {
background: #F60;
}
</style>
<script type="text/javascript">
window.onload=function ()
{
var oNav=document.getElementById('nav');
var aInput=getByClass(oNav, 'btn')[0].getElementsByTagName('input');
var i=0;
for (i=0; i<aInput.length; i++)
{
aInput[i].onclick=function ()
{
alert('测试')
};
};
};
</script>
</head>
<body>
<div id="nav">
<div class="btn">
<input type="button" value="按钮一" />
<input type="button" value="按钮二" />
<input type="button" value="按钮三" />
</div>
<div class="btn">
<input type="button" value="按钮四" />
<input type="button" value="按钮五" />
<input type="button" value="按钮六" />
</div>
</body>
</html>