案例:javascript案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<body>
3
4
<form id="myForm">
5
Text: <input type="text" size="20" value="Hello World" />
6
</form>
7
8
<script type="text/javascript">
9
x=document.getElementsByTagName('form')[0];
10
document.write("Form id: " + x.id);
11
document.write("<br />");
12
document.write("An alternate way: ");
13
document.write(document.getElementById('myForm').id);
14
</script>
15
16
</body>
17
</html>
18