0

我试图找出仅在 IE9 中更改属性的高度/宽度的原因。

有一个 Firebug 功能“属性更改中断” https://getfirebug.com/wiki/index.php/Break_On_ ...

我在我的代码中包含了 firebug-lite 脚本。 https://getfirebug.com/firebuglite

但是不幸的是,右键单击 firebug lite 中的元素并没有弹出上下文菜单:(

firebug lite 是否支持“属性更改中断”?

还是有替代方法?

谢谢,拉斯

4

1 回答 1

0

呜呼!!通过http://help.dottoro.com/ljdchxcl.php了解如何在属性更改时显示消息

<body onload="InitListener ();">
....

<script type="text/javascript">
    function InitListener () {
        var elemToCheck = document.getElementById ("objectelementid");
        if (elemToCheck.addEventListener) { 
            // all browsers except IE before version 9
            elemToCheck.addEventListener ('DOMAttrModified', OnAttrModified, false);    
            // Firefox, Opera, IE
        }
        if (elemToCheck.attachEvent) {  
            // Internet Explorer and Opera
            elemToCheck.attachEvent ('onpropertychange', OnAttrModified);   
            // Internet Explorer
        }
        console.log("events attached");
        // Test the event works
        elemToCheck.setAttribute("width","333");
        console.log("something happened");
    }

    function OnAttrModified (event) {
        var message = "";
        if ('attrChange' in event) {    
            // Firefox, Opera, Internet Explorer from version 9
            message += "Something has happened to an attribute of the " +
                            event.target.tagName + " element.\n";
            message += "The value of the " + event.attrName +
                            " attribute has been changed from "
                        + event.prevValue + " to " + event.newValue + ".";
        }

        if ('propertyName' in event) {  // Internet Explorer
            message = "The " + event.propertyName + " property of the "
                       + event.srcElement.tagName + " element has been changed.";
        }

        console.log(message);
    }
</script>

不幸的是,测试无效,似乎IE9如果没有宽度或高度会自动调整视频大小......必须是一个功能......深深的喜悦......

于 2012-10-26T02:45:46.393 回答