小编acj*_*ren的帖子

" - [1,]"在"if(! - [1,] &&!window.XMLHttpRequest)"中的含义是什么?

我找到下面的代码,但我无法理解这一点.

if (!-[1, ] && !window.XMLHttpRequest) {
    document.execCommand("BackgroundImageCache", false, true);
}
Run Code Online (Sandbox Code Playgroud)

什么if(!-[1,])意思?谢谢

javascript

5
推荐指数
1
解决办法
227
查看次数

为什么只能使用最新的按钮?我发现其他按钮的onclick函数为null

function B(sName) {
    this.name = sName;
}
B.prototype = {
    instanceCreatButtonCount: 0,
    funA: function () { // alert instance's name
        alert(this.name);
    },
    funB: function () { // create a button which clikced can alert this instance's name through funA;
        var that = this;
        B.prototype.instanceCreatButtonCount++;
        var id = "_id" + that.instanceCreatButtonCount;
        var str = "<button id='" + id + "' >clike me</button>";
        var a = document.getElementById("btns");
        a.innerHTML += str;
        var btn = document.getElementById(id);
        btn.onclick = function () {
            that.funA();
        };
    } …
Run Code Online (Sandbox Code Playgroud)

javascript

5
推荐指数
1
解决办法
57
查看次数

标签 统计

javascript ×2