JavaScript高级程序设计学习笔记2: 模拟函数重载
用arguments对象检测传递给函数的参数个数:arguments.length
function test(){
if(arguments.length == 1)
alert(arguments[0] + ",你好");
else if(arguments.length == 2)
alert(arguments[0] + "," + arguments[1] + ",你们好")
else
alert("大家好");
}
test(); //输出: 大家好
test("a"); //输出: a,你好
test("a","b"); //输出: a,b,你们好
test("a","b","c","d"); //输出: 大家好
相关文档:
javascript中的null和undefined
本文装载网络,版权归原作者所有。
null :表示无值;
undefined : 表示一个未声明的变量,
或已声明但没有赋值的变量,
&nb ......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>贪食蛇</title></head>
<body>
<mce:style type="text/css"><!--
.tab ......
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>滚动新闻类</title>
<style type="text/css">
body {
  ......
JSP+JavaScrip
t打造二级级联下拉菜单:
(个人博客:www.duduct.com)
class(一级栏目信息):classId(自动编号),className(栏目名称),
Nclass(二级栏目信息),
NclassId(自动编号),NclassName(栏目名称),parentId(一级栏目id,与class表中的classId关联)
......