我把老师的代码抄了一遍,不知道错在哪。
<html>
<head>
<title>hello</title>
<script>
function show_text(id,text)
{ document.getElementById(id).innerHTML=text;
}
function show_color(id,color)
{ document.getElementById(id).style.color=color;
}
</script>
<style>
div p { color : #f00 }
.py { font-size : 40px; }
#l1 { width : 200px; font-size:40ppx; }
</style>
</head>
<body>
<hl>hello</hl>
<div>World</div>
<p class="py">python</p>
<label id="l1">test</label>
<div>
<a href="javascript:void(0);" onclick=' javascript:show_text("l1","My First JavaScript");'>My First JavaScript</a>
<a href="javascript:void(0);" onclick=' javascript:show_text("l1","Hello python");'>Hello python</a>
<a href="javascript:void(0);" onclick=' javascript:show_text("l1","#0f0");'>green</a>
<a href="javascript:void(0);" onclick=' javascript:show_text("l1","#f00";'>red</a>
</div>
</body>
</html>