此IE4文档对象模型(DOM)在Microsoft的Internet Explorer浏览器的版本4中引入。IE 5和更高版本包括对大多数基本W3C DOM功能的支持。
要使用IE4 DOM方法访问文档属性,请尝试运行以下代码-
<html>
<head>
<title> Document Title </title>
<script>
<!--
function myFunc() {
var ret = document.all["heading"];
alert("Document Heading : " + ret.innerHTML );
var ret = document.all.tags("P");;
alert("First Paragraph : " + ret[0].innerHTML);
}
//-->
</script>
</head>
<body>
<h1 id = "heading">This is main title</h1>
<p>Click the following to see the result:</p>
<form id="form1" name = "FirstForm">
<input type = "button" value = "Click Me" onclick = "myFunc();" />
<input type = "button" value = "Cancel">
</form>
<form d = "form2" name = "SecondForm">
<input type="button" value="Don't ClickMe"/>
</form>
</body>
</html>