希望大家能指出错误
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title提示对话框</title>
<style type="text/css">
</style>
<script type="text/javascript">
function to(x){
var txt=document.getElementById("txt").value;
var b=document.getElementByName("b");
switch(x){
case 1;
document.getElementById("a").innerHTML +=txt;
break;
case 2;
b[0]innerHTML +=txt;
break;
case 3;
document.getElementById("main").innerHTML=txt;
break;
}
}
</script>
</head>
<body>
<div id="main">
<div id="a">id=a的元素</div>
<a name="b">name=b的元素:</a>
<br />
<a name="b">name=b的元素:</a>
<br />
<a name="b">name=b的元素:</a>
<br />
<input type="text" id="txt" value="" size="30" />
<br />
<button onclick="to(1);">写入id=a的元素</button>
<button onclick="to(2);">写入name=b的第二个元素</button>
<button onclick="to(3);">写入id=main的元素</button>
</div>
</body>
</html>
运行不对啊
谢谢