新人初学jquery,在函数调用上遇到点问题~~~ jqueryfunctionjavascript 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 第三种可以的啊 你没定义show方法吧 第六个 是因为方法的返回值做参数了 。6.function show(){return “show2”}function show2(){alert("123");}$(function(){setInterval(show(),3000);}) setInterval("show()",3000);这个调用是在全局内调用,也就是这个方法必须是window下的一个方法。 0输出的地方可证明。而在jquery的ready函数里边,上下文是document,所以不能调用。2,3输出的地方可证明。<!doctype html><html lang="en-US"><head> <meta charset="UTF-8"> <title></title> <script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.js"></script></head><body><script type="text/javascript"> function show(){ console.log(222);// alert("123"); } console.log(0, show == window.show); console.log(1, this); $(function(){ console.log(2, this); console.log(3, $(this)); console.log(4, show == window.show); function fn(){ console.log('fn'); } setInterval("show()",3000); })</script></body></html> $(function(){ });这个方法只是粗暴的认为是window.onload的加强版,一般做为方法的初始调用,里边不建议混写代码。一般出问题的可能比较多,比如这样:function fn(){ setInterval(function(){ console.log('test'); }, 3000);}$(function(){ fn()}); 这里写错了,$(function(){ function show(){ alert("123"); } 1setInterval(show,2000);})我定义了,还是不可以的 求助 关于a href onclick的写法 js里 match() 看不懂的调用方式 请问javscript函数问题? 50分问个限制多行文本框字数的问题,第一个帮我解决的分全给他 怎样判断一个变量是否存在数组中 !!求救!!!!这段代码错在哪拉????? 关于网站换色的问题 有4个输入框,长度都是2,能不能填完一个输入框,光标自动移到下一个输入框??? 页面替换问题 字符串切分成二维组数.HELP ME(最后的60分,帮帮我) 这种JS是用什么方式加密的? jQuery的wrap方法不兼容ie7
function show(){
return “show2”
}function show2(){
alert("123");
}
$(function(){
setInterval(show(),3000);
})
这个调用是在全局内调用,也就是这个方法必须是window下的一个方法。 0输出的地方可证明。
而在jquery的ready函数里边,上下文是document,所以不能调用。2,3输出的地方可证明。<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.js"></script>
</head>
<body>
<script type="text/javascript">
function show(){
console.log(222);
// alert("123");
}
console.log(0, show == window.show);
console.log(1, this);
$(function(){
console.log(2, this);
console.log(3, $(this));
console.log(4, show == window.show); function fn(){
console.log('fn');
} setInterval("show()",3000);
})
</script>
</body>
</html>
});
这个方法只是粗暴的认为是window.onload的加强版,一般做为方法的初始调用,里边不建议混写代码。一般出问题的可能比较多,比如这样:function fn(){
setInterval(function(){
console.log('test');
}, 3000);
}$(function(){
fn()
});
这里写错了,
$(function(){
function show(){
alert("123");
}
1setInterval(show,2000);
})
我定义了,还是不可以的