<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document </title>
<meta name="generator" content="editplus" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
您喜欢的城市:<br>
<ul>
<li id="bj" value="beijing">北京</li>
<li id="sh" value="shanghai">上海</li>
<li id="cq" value="chongqing">重庆</li>
</ul>
您喜欢的游戏:<br>
<ul>
<li id="fk" value="fangkong">反恐</li>
<li id="ms" value="moshou">魔兽</li>
<li id="xj" value="xingji" >星际争霸</li>
</ul>
</body>
<script type="text/javascript">
//添加name
var v=document.getElementById("ms");
var s=v.setAttribute("name","javascript");
alert(s.getAttribute("name"));
</script>
</html>
哪里出问题了?看了跟正确代码一样的
Lemon156
慕的地6079101
网站程序员
相关分类