<!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">做为一个Web开发师来说,如果你想提供漂亮的网页、令用户满意的上网体验,JavaScript是必不可少的工具。</p>
<p id="cor" style="display:none;">做为一个Web用必不可少的工具。</p>
<form>
<input type="button" onclick="hidetext()" value="隐藏内容" />
<input type="button" onclick="showtext()" value="显示内容" />
<input type="button" onclick="hidshow()" value="一件隐藏显示">
</form>
</body>
</html>