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%"
// 把 所有的 % 替换为 #
......
1、直接在前台调用 javascript 函数
很简单,在 head 元素之间加入 script 元素,将 type 元素设置为 " text/javascript "
如:
<head runat="server">
<mce:script type="text/javascript" ><!--
function ShowName(str)
{
alert("您的名字为:("+str+")");
}
// --></mce:script>
< ......
1.document.write( " "); 输出语句
2.JS中的注释为//
3.传统的HTML文档顺序是:document- >html- >(head,body)
4.一个浏览器窗口中的DOM顺序是:window- >(navigator,screen,history,location,document)
5.得到表单中元素的名称和值:document.getElementById( "表单中元素的ID號 ").name(或value)
6 ......
用call方法实现继承
function classA(sColor){
this.color=sColor;
this.sayColor=function(){
alert(this.color);
......
<!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 ......