<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>display</title>
<script type="text/javascript">
function hidetext()
{
var mychar = document.getElementById("con");
document.getElementById("con").style.display="none"
}
function showtext()
{
var mychar = document.getElementById("con");
document.getElementById("con").style.display="block"
}
</script>
</head>
<body>
<div="background=red;width:300px;height:500px;" >
<h1>JavaScript</h1>
<p id="con">做为一个Web开发师来说,如果你想提供漂亮的网页、令用户满意的上网体验,JavaScript是必不可少的工具。</p>
</div>
<form>
<input type="button" onclick="hidetext()" value="隐藏" />
<input type="button" onclick="showtext()" value="显示" />
</form>
</body>
</html>
你看清楚你div里怎么加样式????添加样式的代码错了,搞对了就行
niwenwodezhegewentiwoyebuzhidao buguonikeyishezhixiatoumingdu