html 点击按钮隐藏,点击另外一个按钮显示

<input type="button" value="开始" type="submit" onclick="newform.action='/work/saveWork';newform.submit();"/>
<input type="button" value="结束" type="submit" onclick="newform.action='/work/updata';newform.submit();"/>

第1个回答  2017-03-03
<div id="xxx" style="display:block">ないよう</div>
<input type="button" onClick="aaa()" value="隐藏">
<input type="button" onClick="aaa()" value="显示">

<script>
function aaa(){if(document.getElementById("xxx").style.display=="block"){document.getElementById("xxx").style.display="none";}else{document.getElementById("xxx").style.display="block";}
}

</script>
百度贴吧:安林网络吧本回答被提问者和网友采纳
第2个回答  2017-02-27
show和hide使用追问

怎么用啊?应该在哪里添加

追答<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="jquery.min.js">
</script>
<script>
$(document).ready(function(){
  $("#hide").click(function(){
    $("p").hide();
  });
  $("#show").click(function(){
    $("p").show();
  });
});
</script>
</head>
<body>
<p>如果你点击“隐藏” 按钮,我将会消失。</p>
<button id="hide">隐藏</button>
<button id="show">显示</button>
</body>
</html>