如何编写脚本以使用 IE4 DOM 方法访问文档属性?
htmljavascriptprogramming scripts更新于 2024/5/31 3:56:17
此 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&";>这是主标题</h1>
<p>点击以下内容查看结果:</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>
相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

