Javascript: setTimeout()使用及 setInterval()使用
Evaluates an expression after a specified number of milliseconds has elapsed.
(在指定时间过后执行指定的表达式)
Syntax:
iTimerID = window.setTimeout(vCode, iMilliSeconds [, sLanguage])
Parameters
vCode
Required. Variant that specifies the function pointer or string that indicates the code to be executed when the specified interval has elapsed.
iMilliSeconds
Required. Integer that specifies the number of milliseconds.
sLanguage
Optional. String that specifies one of the following values:
JScript
Language is JScript.
VBScript
Language is VBScript.
JavaScript
Language is JavaScript.
Return Value
Integer. Returns an identifier that cancels the evaluation with the clearTimeout method.
==============================================================
以上内容摘自某本JScript教程(CHM格式,出处不详,跟原作者说声Sorry)
以下内容没抄任何人的,如果有雷同,估计不是你抄偶的就是巧合,嘿嘿.
-------------------------------------------------------------------
setTimeout( alert("3秒种过去了"), 3000);//调用一个函数,允许带常量参数
-------------------------------------------------------------------
<script language="Javascript">
//by zuoyang
var x = 1;
var y = 2;
var z = 3;
var sum;
function Plus(a, b)
{
var z = 0;
var i = 0;
for (i = 0; i < arguments.length; i++)
{
z += arguments[i];
}
setTimeout( function() {alert(z);}, 6000); //可以带变量参数的setTimeout调用形式
return z;
}
setTimeout( function(){ sum = Plus(x, y, z); }, 3000);/*除了可以带变量参数还可以获取返
相关文档:
JavaScript进行GET和POST请求
Web上最常见的请求就是GET请求.每次在浏览器中输入URL并打开也米纳市,就是在向服务器发送一个GET请求.
GET请求:
GET请求的参数使用问号追加到URL的结尾,后米纳给这用&好连接起来的名称/值.例如:
http://www.somewhere.com/page.php?name1=value1&name2=value2&name3=value3
......
js的Function对象在调用过程中具有一个arguoments属性,它是由脚本解释器创建的,这也是创建arguments对象唯一途径。arguments对象可以看做是一个Array对象,它具有length属性,可以通过序号访问每一个参数。而且,通过arguments 的callee属性可以获取对只在执行的Function对象的引用,如下 ......
JavaScript常用验证函数
引自:http://www.webdeveloping.cn/blog/?action=show&id=209
//校验是否全由数字组成
function isDigit(s) {
var patrn=/^[0-9]{1,20}$/;
i ......
原文出处: http://www.dnew.cn/post/196.htm
先看下下面几种写法
1.function f(x){return x*x;};f(x);
2.(function(x){return x*x;})(x);
3.(function(x){return x*x;}(x));
第一种我们应该都很熟悉了,这是我们经常使用的写法。第二第三种都是匿名函数的写法。
------------------------------------------------ ......