<HTML><Head> <title>Page Dwell time</title></Head><Bodyonload= "init (); Window.settimeout (' Show_secs () ', 1);" > <Scriptlanguage= "JavaScript"> varAp_name=Navigator.appname; varAp_vinfo=navigator.appversion; varAp_ver=parsefloat (ap_vinfo.substring (0, Ap_vinfo.indexof ('('))); varTime_start= NewDate (); varClock_start=Time_start.gettime (); varDL_OK= false; vars_secs_spent; vars_mins_spent; functioninit () {if(Ap_name== "Netscape" &&Ap_ver>= 3.0) Dl_ok= true; return true; } functionget_time_spent () {varTime_now= NewDate (); return( (Time_now.gettime ()-Clock_start)/ +); } functionshow_secs () {varI_total_secs=Math.Round (Get_time_spent ()); vari_secs_spent=I_total_secs% -; vari_mins_spent=Math.Round ((I_total_secs- -) / -); S_secs_spent= "" +((I_secs_spent> 9) ?i_secs_spent:"0" +i_secs_spent); S_mins_spent= "" +((I_mins_spent> 9) ?i_mins_spent:"0" +i_mins_spent); Document.fm0.time_spent.value=s_mins_spent+ ":" +s_secs_spent; Window.settimeout ('show_secs ()', +); } window.onbeforeunload =Onbeforeunload_handler; Window.onunload=Onunload_handler; functionOnbeforeunload_handler () {varShow=s_mins_spent+ ":" +s_secs_spent; //Do SomeThing } functionOnunload_handler () {varShow=s_mins_spent+ ":" +s_secs_spent; //Do SomeThing } </Script> <formname= "FM0"onsubmit= "0"> <FontColor= "#888888"size= "-1">Your stay time on this page:</Font> <inputtype= "text"name= "Time_spent"size= "7"onfocus= "This.blur ()"> </form></Body></HTML>
Page Jump Trigger event:
onBeforeUnload
Enter page start time, Trigger action event when page is closed