我正在开发一个使用HTML组件文件(.htc)的项目,现在我想升级应该适用于IE10所有浏览器的项目,因为IE10不再支持htc文件。那么请给我解决方案,我们如何转换我们使用htc文件的项目部分。请参考以下代码:
this.Style.Add("BEHAVIOR", "url(xyz.htc)");
我想替换此文件中写的htc文件和代码。应该用什么代替htc文件。
请帮忙。
答案 0 :(得分:2)
将更新.htc(HTML组件)自定义属性更新为js,因为IE10标准模式不支持htc。
选中此link
编辑:
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>