function Hello() { alert("hello , everybody!");};
Hello();
function SayHelloTo(somebody) {alert("hello , " + somebody + "!");
};
SayHelloTo("张三"); function Hello() { alert("hello , everybody!");};
Hello();
function Hello(somebody) {alert("hello , " + somebody + "!");
};
Hello("张三"); function ShowArguments() {var args = "";
for (var i = 0; i < arguments.length; i++) {
args += arguments[i] + ",";};
alert(args.substr(0, args.length - 1));
};
ShowArguments(1, 2, 3, 4, 5, 6, 7);
function Hello() { if (arguments.length == 0) { alert("hello , everybody!");}
else {alert("hello , " + arguments[0] + "!");
};
};
Hello();
Hello("张三"); function Increase(arg) {if (typeof arg == "undefined") {
alert("请输入参数");}
if (typeof arg == "string") {
alert(String.fromCharCode(arg.charCodeAt(0) + 1));
}
if (typeof arg == "number") {
alert(arg + 1);
}
};
Increase();
Increase("a");Increase(1);
function() {……
};
function Each(array, fun) {for (var i = 0; i < array.length; i++) {
fun(array[i]);
};
};
var nums = [1, 2, 3, 4, 5, 6, 7]; Each(nums, function(arg) {alert(arg);
});
//在窗体加载时,在标题上显示当前时间 window.onload = function() { document.title = new Date().toString();};
//也可以将匿名方法传入定时器中 setInterval(function() { document.title = new Date().toString();}, 1000);
var Hello = function() {
alert("hello , everybody!");};
(function() { alert("hello , everybody!");})();
(function(somebody) {alert("hello , " + somebody + "!");
})("张三"); var student = { Name: "张三",Age: 20,
Introduce: function() {alert("我叫" + this.Name + ",今年" + this.Age + "岁了!");
} };
window.onload = (function(obj) { return function() { obj.Introduce(); }; })(student);
function Sum(fun, x) { if (x <= 0) return 0; return fun(x) + Sum(fun, x - 1);};
alert(Sum(function(i) { return i * i; }, 100));
function Point() {};
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有