JavaScript特效:页面停留时间
<script language="javascript" type="text/javascript">
var TempTime=new Date().getTime();
function StayTime(){
var NowTime=new Date().getTime();
var Time=NowTime-TempTime;
var Days=Math.floor(Time/(24*60*60*1000));
Time-=Days*24*60*60*1000;
var Hours=Math.floor(Time/(60*60*1000));
Time-=Hours*60*60*1000;
var Minutes=Math.floor(Time/(60*1000));
Time-=Minutes*60*1000;
var Seconds=Math.floor(Time/1000);
alert("您在本页面停留了:"+String(Days)+"天"+String(Hours)+"时"+String(Minutes)+"分"+String(Seconds)+"秒");
}
</script>
<body onunload="StayTime();">
实例演示:http://www.fengyekun.com/Study_711.html
相关文档:
<script language="javascript">
<!--
String.prototype.replaceAll = stringReplaceAll;
function stringReplaceAll(AFindText,ARepText){
raRegExp = new RegExp(AFindText,"g");
return this.replace(raRegExp,ARepText)
}
var content = "%sfasf%sfd%asdfsadf%1111%"
// 把 所有的 % 替换为 #
......
if (elename.equalsIgnoreCase("back") || elename.equalsIgnoreCase("1"))
return "<a href=\"javascript:window.history.back()\">后退</a>";
&nbs ......
js验证表单大全
1. 长度限制
<script>
function test()
{
if(document.a.b.value.length>50)
{
alert("不能超过50个字符!");
document.a.b.focus();
return false;
}
}
</script>
<form name=a onsubmit="return test()">
<textarea name="b" cols="40" wrap="VIRTUAL" rows="6"&g ......
<!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;&n ......
<!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>
<meta http-eq ......