<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>