js獲取上一頁、當前頁及域名url方法,JS反回上一頁的方法


<html>

<head>

<title>js獲取上一頁url,js獲取前一頁地址,javascripts獲取上一頁url,javascript獲取前一頁地址</title>

<meta http-equiv="keywords" content="" />

</head>

<body>

<script language="javascript">

document.write("js獲取當前域名"+window.location.host+"或者"+document.domain+"<br>");

document.write("js獲取當前url"+window.location.href+"<br>");

document.write("js獲取上(前)一頁url"+document.referrer);

</script>

</body>

</html>

 

以上是獲取的代碼,以下是具本的應用:

 

在<body>中插隊入

<script language="javascript">
function goUrl(){
window.location.href=document.referrer;
}
</script>

然后在返回鏈接上這樣寫:

<a href="javascript:goUrl();">返回上一頁</a>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM