顯示和隱藏是實(shí)現(xiàn)不了
<!DOCTYPE HTML>
<html>?
<head>
<title>reshen</title>
? ? ? ?<script type="text/javascript">?
? ? ? ? ? ? ? ? ?function hidden(){
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?var c=document.getElementById("gm");
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?c.style.display="none";
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ?function show(){
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?var c=document.getElementById("gm");
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?c.style.display="block";
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?}
? ? ? ?</script>
</head>
<body>
? ? ? ?<p id="gm">小明和小紅去學(xué)校</p>
? ? ? ?<form>
? ? ? ? ? ? ?<input type="button" onclick="hidetext()" value="隱藏內(nèi)容" />?
? ? ? ? ? ? ?<input type="button" onclick="showtext()" value="顯示內(nèi)容" />?
? ? ? ?</form>
</body>
</html>
2016-11-28
你HTML中的事件處理程序函數(shù)名和JS的函數(shù)名不同,改成一樣的就好了。
2016-11-28
上下函數(shù)名不同
2016-11-28
<input type="button" onclick="hidetext()" value="隱藏內(nèi)容" /> 改為<input type="button" onclick="hidden()" value="隱藏內(nèi)容" />?
<input type="button" onclick="showtext()" value="顯示內(nèi)容" /> 改為<input type="button" onclick="show()" value="顯示內(nèi)容" />?