转载自: http://hi.baidu.com/%D2%D7%D4%EE%BB%A8/blog/item/bad24c0b708725366159f35a.html
在ff下调试setTimeout时发现如下错误:
useless setTimeout call (missing quotes around argument?)
解决方案来自:http://www.cnblogs.com/zhongru_tu/archive/2008/09/02/1282078.html
自己的实例为:
/**
* 取消弹出浮层
* @param mask 遮罩层id
* @param layer 浮层id
*/
function layer_cancel(mask,layer){
jQuery('#'+mask).hide();
jQuery('#'+layer).hide();
}
setTimeout(layer_cancel('s_mask','s_layer'),1000);
报错:useless setTimeout call (missing quotes around argument?)
解决方法如下:
setTimeout(function(){layer_cancel('s_mask','s_layer');},1000);
setTimeout("alert('對不起, 要你久候')", 3000 );