日期:2014-05-16 浏览次数:20429 次
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title></title>
<script type="text/javascript">
var _btn ;//记录上次点击的按钮
function togglediv(obj,divid)
{
var key = obj.value;
var divobj = document.getElementById(divid);
if(key == _btn||typeof(_btn) =="undefined")
{
divobj.style.display=divobj.style.display==""?"none":"";
}else{
divobj.style.display="";
}
_btn = key;
}
</script>
</head>
<body>
<div id="test">测试</div>
<input type="button" value="bt1" onclick="togglediv(this,'test')">
<input type="button" value="bt2" onclick="togglediv(this,'test')">
<input type="button" value="bt3" onclick="togglediv(this,'test')">
</body>
</html>