5

I am working on a project which is using HTML Components files (.htc), now i want to upgrade the project that should work on all the browsers with IE10, as htc files are no longer supported by IE10. So Please give me solution how we can convert the part of project where we are using htc files. please refer below code:

this.Style.Add("BEHAVIOR", "url(xyz.htc)");

I want to replace this htc file and code written inside this file. What should needs to be put in replacement of htc file.

Please help.

4

1 回答 1

2

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

检查此链接

编辑 :

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);
}

然后在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>
于 2014-06-26T10:01:43.810 回答