当把在head头部的js代码加了onload后,无法显示改节点击按钮隐藏的效果,去掉就成功显示
<script>
window.onload=function(){
function touch1(){
document.getElementById("con").style.display="none";
}
function touch2(){
document.getElementById("con").style.display="display";
}
}
</script>
</head>
<body>
<div>aaaaa</div>
<div id="con">aaaaaaaaaaaaa</div>
<form>
<input type="button" onclick="touch1()" value="hide" >
<input type="button" onclick="touch2()" value="open">
</form>