案例:javascript案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<!DOCTYPE html>
2
<html>
3
<body>
4
5
<ul><li>Coffee</li><li>Tea</li></ul>
6
7
<p id="demo">请点击按钮来改变某个列表项的文本。</p>
8
9
<button onclick="myFunction()">试一下</button>
10
11
<script>
12
function myFunction()
13
{
14
var list = document.getElementsByTagName("UL")[0]
15
list.getElementsByTagName("LI")[0].innerHTML = "Milk";
16
}
17
</script>
18
19
</body>
20
</html>
21