请帮我看下哪里错了
function size(){
var si=document.getElementById("txt");
si.style.width="500px";
si.style.height="500px";}
改变宽高是这么写的,但为啥点击按钮没反应
function size(){
var si=document.getElementById("txt");
si.style.width="500px";
si.style.height="500px";}
改变宽高是这么写的,但为啥点击按钮没反应
2016-03-21
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8" />
<title>javascript</title>
<style type="text/css">
body{font-size:12px;}
#txt{
height:400px;
width:600px;
border:#333 solid 1px;
padding:5px;}
p{
line-height:18px;
text-indent:2em;}
</style>
</head>
<body>
<h2 id="con">JavaScript课程</H2>
<div id="txt">
<h5>JavaScript为网页添加动态效果并实现与用户交互的功能。</h5>
<p>1. JavaScript入门</p>
<p>2. JavaScript进阶</p>
<p>3. 学完以上两门c</p>
</div>
<form>
<input type="button" value="改变颜色" onClick="color()">
<input type="button" value="改变宽高" onClick="size()">
<input type="button" value="隐藏内容" onClick="hide()">
<input type="button" value="显示内容" onClick="show()">
<input type="button" value="取消设置" onClick="reset()">
</form>
<script type="text/javascript">
function color(){var co=document.getElementById("txt");co.style.color="red";}
function size(){var si=document.getElementById("txt");si.style.width="500px";si.style.height="500px";}
function hide(){var hi=document.getElementById("txt");hi.style.display="none";}
function show(){var sh=document.getElementById("txt");sh.style.display="block";}
function reset(){
var a=confirm("reset?");
if(a==true)
{}
}
</script>
</body>
</html>
举报