为什么我更改时不解析代码
var comments_switcher = (function(){
var switcher = null;
var show = 'Show comments';
var hide = 'Hide comments';
function init(){
if ( switcher == null ) switcher = document.getElementById("comments_switch");
}
function switched_on(){
return switcher.value == show;
}
return {
trigger : function(do_init){
if ( do_init ) init();
switcher.value = switched_on() ? hide : show;
}
}
})();
进入
var comments_switcher = (function(){
var switcher = null;
var show = 'Show comments';
var hide = 'Hide comments';
function init(){
if ( switcher == null ) switcher = document.getElementById("comments_switch");
}
return {
trigger : function(do_init){
if ( do_init ) init();
switcher.value = switched_on() ? hide : show;
},
switched_on : function(){
return switcher.value == show;
}
}
})();
为什么xmlhttp.onreadystatechange
在给出函数对象而不是时不起作用function() {}
?