更换 HTC 文件

Sau*_*abh 5 javascript css xhtml internet-explorer html-components

我正在开发一个使用 HTML 组件文件 (.htc) 的项目,现在我想升级该项目,该项目应该适用于 IE10 的所有浏览器,因为 IE10 不再支持 htc 文件。所以请给我解决方案,我们如何转换我们使用 htc 文件的项目部分。请参考以下代码:

this.Style.Add("BEHAVIOR", "url(xyz.htc)");
Run Code Online (Sandbox Code Playgroud)

我想替换这个 htc 文件和写在这个文件中的代码。替换htc文件需要放什么。

请帮忙。

Cod*_*ned 2

由于 IE10 标准模式不支持 htc,因此将 .htc(HTML 组件)自定义属性更新为 js。

检查此链接

编辑 :

var Method_Behavior = {
    get: function () {
        return this.style.behavior
    },
    set: function (val) {
        this.style.behavior = val
    }
}

//input
if (!HTMLInputElement.prototype.hasOwnProperty("Behavior")) {
    Object.defineProperty(HTMLInputElement.prototype, "Behavior", Method_Behavior);
}
Run Code Online (Sandbox Code Playgroud)

然后在Html页面中

<script src="new_js_file_name" type="text/javascript"></script>
    <script type="text/javascript">
        function loaded() {
            document.getElementById("Id_Name").Behavior = "new_behavior";
        }
    </script>
Run Code Online (Sandbox Code Playgroud)