11111111111111111111111
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>display</title>
<script type="text/javascript">
var toggleText = function (type){
var con = document.getElementById('con');
type = type || 'show';
var select = {
'show':function(){
con.style.display = 'block';
},
'hide':function(){
con.style.display = 'none';
}
}
if(typeof select[type] !== 'function') return false;
select[type]();
}
</script>
</head>
<body>
<h1>JavaScript</h1>
<p id="con">做为一个Web开发师来说,如果你想提供漂亮的网页、令用户满意的上网体验,JavaScript是必不可少的工具。</p>
<form>
<input type="button" onclick="toggleText('hide')" value="隐藏内容" />
<input type="button" onclick="toggleText()" value="显示内容" />
</form>
</body>
</html>