案例:javascript案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<!DOCTYPE html>
2
<html>
3
<body>
4
5
<h3>演示如何访问 LI 元素</h3>
6
7
<ol>
8
  <li id="myLi">咖啡</li>
9
  <li>红茶</li>
10
  <li>牛奶</li>
11
  <li>橙汁</li>
12
</ol>
13
14
<p>点击按钮来设置列表项从数字 300 开始递增。</p>
15
16
<button onclick="myFunction()">试一下</button>
17
18
<script>
19
function myFunction()
20
{
21
var x = document.getElementById("myLi");
22
x.value = "300";
23
}
24
</script>
25
26
</body>
27
</html>
28