日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

js怎么获取访问页数记录(知道的能不能告诉我一下)

發布時間:2025/4/5 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 js怎么获取访问页数记录(知道的能不能告诉我一下) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

這次老大布置了一個任務,但是我有幾個地方不會,請大家幫一個忙吧。這個任務主要就是使用js獲取:1.網站來源截取2.上網IP截取3.上網地址截取4.操作系統截取5.分辨率截取6.訪問頁數記錄,但是我只能獲取到1.網站來源4.操作系統5.分辨率這幾個,其中上網IP、地址我是截取到,但是有人說我這種截法是不行的,所以你們誰看到的能不能告訴我一下這幾個是怎樣截取的,謝謝你們了,這個是我寫的代碼,能不能告訴我一下那個文字效果是什么啊


<!DOCTYPE HTML>

<html>

<head>

<meta charset="UTF-8">

<title>當前用戶訪問信息</title>

<script src="http://apps.bdimg.com/libs/jquery/1.9.1/jquery.min.js"></script>

<style type="text/css">?

.mains{width:400px;height:300px;border:1px solid #333;margin-left:60px;margin-top:60px;font-size:14px;padding:10px;}

.guanjian{width:30%;height:30px;float:left;}

.huoqu{width:70%;height:30px;float:left;}

</style>

</head>

<body>

<div class="mains">

<h1>系統分析</h1>

<div><div class="first">初次來源:</div><div class="huoqu laiyuan"></div></div>

<div><div class="guanjian">搜索關鍵詞:</div><div class="huoqu word"></div></div>

<div><div class="guanjian">上網IP:</div><div class="huoqu ip">

<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script> ?

<script type="text/javascript"> ?document.write(returnCitySN["cip"]) ?</script>

</div></div>

<div><div class="guanjian">上網地址:</div><div class="huoqu">

<script type="text/javascript"> ?document.write(returnCitySN["cname"]) ?</script>

</div></div>

<div><div class="guanjian">操作系統:</div><div class="huoqu xitong"></div></div>

<div><div class="guanjian">分辨率:</div><div class="huoqu fenbianlv"></div></div>

<div><div class="guanjian">訪問頁數:</div><div class="huoqu"></div></div>

</div>


<script type="text/javascript">?

//獲取初次來源

$ly=document.write(document.referrer);

$(".laiyuan").text($ly);


//獲取搜索關鍵詞

function GetQueryString($name){

? ? var $index=document.referrer.indexOf($name+"="),$e='';

? ? if($index>1){

? ? ? ? $e=document.referrer.substring($index+$name.length+1);

? ? ? ? if(($index=$e.indexOf("&"))>0){

? ? ? ? ? ? $e=$e.substring(0,$index);

? ? ? ? }

? ? }

? ? return $e;

}

$wd=GetQueryString("wd");

if($wd&&$wd.length>0){

? ? $wd=decodeURIComponent($wd);}

$(".word").text($wd);

//獲取上網IP




//獲取上網地址

//獲取操作系統

function detectOS() {

? ? var sUserAgent = navigator.userAgent;

? ? var isWin = (navigator.platform == "Win32") || (navigator.platform == "Windows");

? ? var isMac = (navigator.platform == "Mac68K") || (navigator.platform == "MacPPC") || (navigator.platform == "Macintosh") || (navigator.platform == "MacIntel");

? ? if (isMac) return "Mac";

? ? var isUnix = (navigator.platform == "X11") && !isWin && !isMac;

? ? if (isUnix) return "Unix";

? ? var isLinux = (String(navigator.platform).indexOf("Linux") > -1);

? ? if (isLinux) return "Linux";

? ? if (isWin) {

? ? ? ? var isWin2K = sUserAgent.indexOf("Windows NT 5.0") > -1 || sUserAgent.indexOf("Windows 2000") > -1;

? ? ? ? if (isWin2K) return "Win2000";

? ? ? ? var isWinXP = sUserAgent.indexOf("Windows NT 5.1") > -1 || sUserAgent.indexOf("Windows XP") > -1;

? ? ? ? if (isWinXP) return "WinXP";

? ? ? ? var isWin2003 = sUserAgent.indexOf("Windows NT 5.2") > -1 || sUserAgent.indexOf("Windows 2003") > -1;

? ? ? ? if (isWin2003) return "Win2003";

? ? ? ? var isWinVista= sUserAgent.indexOf("Windows NT 6.0") > -1 || sUserAgent.indexOf("Windows Vista") > -1;

? ? ? ? if (isWinVista) return "WinVista";

? ? ? ? var isWin7 = sUserAgent.indexOf("Windows NT 6.1") > -1 || sUserAgent.indexOf("Windows 7") > -1;

? ? ? ? if (isWin7) return "Win7";

? ? }

? ? return "other";

}

$xt=detectOS();

$(".xitong").text($xt);

//獲取分辨率

$fbl_1=screen.width;

$fbl_2=screen.height;

$fbl=$fbl_1+"*"+$fbl_2;

$(".fenbianlv").text($fbl);

//獲取訪問頁數


</script>

</body>

</html>

這個圖片是最終的效果圖,主要獲取的數據在系統分析里面

轉載于:https://blog.51cto.com/xhlsky/1864319

總結

以上是生活随笔為你收集整理的js怎么获取访问页数记录(知道的能不能告诉我一下)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。