javascript常用

1.在网页中加入最后修改日期

<!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>
<script>
	document.write("最后修改日期" , document.lastModified);
</script>
</head>

<body >
	
</body>
</html>

2.图片循环隐现

<!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>
<script language="JavaScript">
	var b = 0;
	var c = true;
	function fade(){
		if(c == true){
			b+=0.1;
		}
		if(b > 0.9){
			b-=0.1;
			c=false;
		}
		if(c == false){
			b-=0.1;
		}
		if(b < 0.1){
			b+=0.1;
			c = true;
		}
		document.tp.style.opacity = b;
		setTimeout("fade()" , 500);
	}
</script>
</head>

<body onload="fade()" >
	<img src="img1.jpg" width="300px" height="300px" name="tp"  />
</body>
</html>

3.

猜你喜欢

转载自blog.csdn.net/qq_38261174/article/details/81112556