0

Internet Explorer 8 再次...

我一直在寻找解决我的 SCRIPT438 错误(SCRIPT438:对象不支持此属性或方法)的解决方案,但它们似乎都不适合我。

我正在使用 swfobject.js,F12 控制台上的错误报告显示第 435 行字符 5 存在错误,这一行:

el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';

该行是此功能的一部分:

function createSWF(attObj, parObj, id) {
    var r, el = getElementById(id);
    if (ua.wk && ua.wk < 312) { return r; }
    if (el) {
    if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
        attObj.id = id;
    }
    if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
        var att = "";
        for (var i in attObj) {
            if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
                if (i.toLowerCase() == "data") {
                    parObj.movie = attObj[i];
                }
                else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
                    att += ' class="' + attObj[i] + '"';
                }
                else if (i.toLowerCase() != "classid") {
                    att += ' ' + i + '="' + attObj[i] + '"';
                }
            }
        }
        var par = "";
        for (var j in parObj) {
            if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
                par += '<param name="' + j + '" value="' + parObj[j] + '" />';
            }
        }
        el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
        objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
        r = getElementById(attObj.id);  
    }

所以'el'不应该是不确定的

这就是我将所有 javascript 添加到 HTML 的方式

<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>

<script src="js/smoothscroll.js"></script>
<script src="js/jquery.placeholder.min.js"></script>
<script src="js/javascript.js"></script>
<script src="js/swfobject.js"></script>
<script src="js/player.js"></script>

我没有两次包含 jquery,jquery.placeholder 是我用来解决源代码中 ie9 占位符问题的插件,可以在这里找到 https://github.com/mathiasbynens/jquery-placeholder

我必须解决这个直到星期一,真的可以使用一些帮助

4

1 回答 1

0

在实际意义上,如果您为您的项目使用编译,您可能会考虑安装 polyfill 包

npm i --save core-js

或者

yarn add core-js

然后在项目入口点的顶部添加

import 'core-js'

目前core-js polyfill 库是实现跨浏览器支持的最简单方法

于 2019-10-25T18:14:41.603 回答