微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何使用IE4 DOM方法编写脚本访问文档属性?

如何使用IE4 DOM方法编写脚本访问文档属性?

此 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>

以上就是如何使用IE4 DOM方法编写脚本访问文档属性?的详细内容,更多请关注编程之家其它相关文章

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐