3-13 编程练习代码,运行失败,求高手指点。
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>挑战题</title>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$("li[name=more]").hide();
function change(){
if($("li a").html()=="更多"){
$("li").show();
$("li a").html("简化")
}else if($("li a").html()=="简化") {
$("li[name=more]").hide()
$("li a").html("更多")
}
}
})
</script>
</head>
<body>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li name="more">6</li>
<li name="more">7</li>
<li name="more">8</li>
<li name="more">9</li>
<li><a href="javascript:;" onclick="change()"> 更多</a></li>
</ul>
</body>
</html>