87,996
社区成员




<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
</head>
<body>
<div id="tip" style="display:none">提示的内容!</div>
<script language="javascript">
//
// 2010-1-4 14:48:21
var tip={
obj:0,//DIV 或者SPAN 对象
start:2,//开始的秒数
len:5,//显示的秒数
tip:function(_obj,_start,_len){
this.obj = _obj;
_start && this.start = _start;
_len && this.len = _len;
setTimeout('display(this.obj)',this.start*1000);
setTimeout('display(this.obj)',(this.start+this.len)*1000);
}
};
function display(obj){
var s = obj.style;
s.display = s.display ? '':'none';
}
//使用
tip.tip(document.getElementById('tip'),2,5);
</script>
</body>
</html>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
</head>
<body>
<div id="tip" style="display:none">提示的内容!</div>
<script language="javascript">
//
// 2010-1-4 14:48:21
var tip={
obj:0, //DIV 或者SPAN 对象
start:2, //开始的秒数
len:5, //显示的秒数
tip:function(_obj,_start,_len){
this.obj = _obj;
//这里的两个&&不知道是做什么的
// _start && this.start = _start;
// _len && this.len = _len;
this.start = _start;
this.len = _len;
//这里的参数以前没有传进去要改了
setTimeout(display(this.obj),this.start*1000);
setTimeout(display(this.obj),(this.start+this.len)*1000);
}
};
//这个函数改了一下
function display(obj) {
return function() {
var s = obj.style;
s.display = s.display ? '' : 'none';
}
}
//使用
tip.tip(document.getElementById('tip'),2,5);
</script>
</body>
</html>
setTimeout(fun1(arg1,arg2),num);
function fun1(arg1,arg2){
return function(){
//这里可以用参数了
}
}
function test(a,b,c) {
a = a||'defaultValue Of a';
b = b||'defaultValue Of b';
c = c||'defaultValue Of c';
document.write('a:'+a+'<br/>b:'+b+'<br/>c:'+c+'<br/><br/>');
}
test();
test('new Value Of a');
test('new Value Of a','new Value Of b');
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
</head>
<body>
<div id="tip" style="display:none">提示的内容!</div>
<script language="javascript">
//
// 2010-1-4 14:48:21
var tip={
obj:0,//DIV 或者SPAN 对象
start:2,//开始的秒数
len:5,//显示的秒数
tip:function(_obj,_start,_len){
this.obj = _obj;
this.start = _start;
this.len = _len;
setTimeout("tip.display()",this.start*1000);
setTimeout("tip.display()",(this.start+this.len)*1000);
},
display: function(){
this.obj.style.display = this.obj.style.display ? '':'none';
}
};
//使用
tip.tip(document.getElementById('tip'),2,5);
</script>
</body>
</html>