相关疑难解决方法(0)

onload函数中定义的函数的未捕获的ReferenceError

HTML:

<div id="myID" onclick="cc(this.id)">Click Here</div>?
Run Code Online (Sandbox Code Playgroud)

JavaScript的:

var timer;
var firing = false;
var begen = function(id) {
    alert('tek');
};

var popupAc = function(id) {
    alert('çift');
};

function cc(id) {
    if (firing) {
        popupAc(id);
        clearTimeout(timer);
        firing = false;
        return;
    }
    firing = true;
    timer = setTimeout(function() {
        //begen(id);
        clearTimeout(timer);
        firing = false;
    }, 250);
}
Run Code Online (Sandbox Code Playgroud)

错误:

Uncaught ReferenceError: cc is not defined 
Run Code Online (Sandbox Code Playgroud)

示例:http://jsfiddle.net/LXSZj/3/

javascript

2
推荐指数
1
解决办法
5341
查看次数

标签 统计

javascript ×1