81,094
社区成员
发帖
与我相关
我的任务
分享
<!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>
<script>
function showDiv1(){
document.getElementById("div1").style.display="";
document.getElementById("div2").style.display="none";
};
function showDiv2(){
document.getElementById("div2").style.display="";
document.getElementById("div1").style.display="none";
};
</script>
</head>
<body onload="showDiv1();">
<div id="div1">
哈哈我是div1
</div>
<div id="div2">
嘿嘿我是div2
</div>
<input type="button" value="showDiv1" onclick="showDiv1()"/>
<input type="button" value="showDiv2" onclick="showDiv2()"/>
</body>
</html>