在IE中删除窗口属性

在IE中删除窗口属性

本文介绍了在IE中删除窗口属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到有关此问题的任何信息;为什么下面的代码在IE中不起作用?

I can't find any information on this issue; why doesn't the following code work in IE?

window.x = 45;
delete window.x;
// or delete window['x'];

IE报告对象不支持此操作"错误.迭代IE问题中的窗口属性与它有什么关系?

IE reports an "object doesn't support this action" error. Does it have anything to do with that iterating over window properties in IE issue?

推荐答案

我会这样做:

    window[x] = undefined;
    try{
        delete window[x];
    }catch(e){}

这篇关于在IE中删除窗口属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 13:37