<!DOCTYPE html><html><head>? <meta charset="UTF-8">? <title>Document</title>?<script type="text/javascript">?? ? ? ? function hidetext() ?? ? { ?? ? ? ? var mychar = document.getElementById("con");? ? ? ? var mychor=document.getElementById("cor");? ? ? ? ? mychar.style.display="none";? ? ? ? ? mychor.style.display="block";? ? } ?? ? function showtext() ?? ? { ?? ? var mychar = document.getElementById("con");? ? ? ? ?var mychor=document.getElementById("cor");? ? ? ? ? ?mychar.style.display="block";? ? ? ? ? ?? ? ? ? ? mychor.style.display="none";? ? }? ? ? ??? ? </script>?</head>?<body> ?? ? <h1>JavaScript</h1> ?? ? <p id="con">做為一個(gè)Web開發(fā)師來說,如果你想提供漂亮的網(wǎng)頁(yè)、令用戶滿意的上網(wǎng)體驗(yàn),JavaScript是必不可少的工具。</p>?? ? <p id="cor" style="display:none;">做為一個(gè)Web用必不可少的工具。</p>?? ? <form>? ? ? ?<input type="button" onclick="hidetext()" value="隱藏內(nèi)容" />?? ? ? ?<input type="button" onclick="showtext()" value="顯示內(nèi)容" />?? ? ? ?<input type="button" onclick="hidshow()" value="一件隱藏顯示">? ? </form></body>?</html>? ?
以下代碼實(shí)現(xiàn)一鍵隱顯示文字、隱藏提示/ 顯示提示、隱藏文字 應(yīng)該怎么寫?
wubin_work
2016-06-27 13:35:57