如何使用W3C DOM方法访问文档属性?
此IE4文档对象模型(DOM)在Microsoft的InternetExplorer浏览器的版本4中引入。IE5和更高版本包括对大多数基本W3CDOM功能的支持。
示例
要使用W3CDOM方法访问文档属性,您可以尝试运行以下代码-
<html>
<head>
<title> Document Title </title>
<script type="text/javascript">
<!--
function myFunc() {
var ret = document.getElementsByTagName("title");
alert("Document Title : " + ret[0].text );
var ret = document.getElementById("heading");
alert(ret.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>热门推荐
7 简短的二胎祝福语
10 简短霸气女儿生日 祝福语
11 祝福语高考小众诗句简短
12 元旦祝福语20秒简短
13 老师过年祝福语大全 简短
14 一生祝福语简短
15 产检祝福语简短霸气
16 朋友店开张祝福语简短
17 生日爱情祝福语大全简短
18 朋友女儿生日祝福语 简短