您好,欢迎访问一九零五行业门户网

我如何编写一个脚本,根据其可用性使用W3C DOM或IE 4 DOM?

如果您希望编写一个能够根据其可用性灵活地使用 w3c dom 或 ie 4 dom 的脚本,那么您可以使用一种功能测试方法,该方法首先检查是否存在确定浏览器是否具有您想要的功能的方法或属性。
以下是显示相同内容的代码片段 -
if (document.getelementbyid) { // if the w3c method exists, use it}else if (document.all) { // if the all[] array exists, use it}else { // otherwise use the legacy dom}
以上就是我如何编写一个脚本,根据其可用性使用w3c dom或ie 4 dom?的详细内容。
其它类似信息

推荐信息