標籤:www 屬性 實現 window word article color keyword ext
第一種:
<script language="javascript" type="text/javascript">
window.location.href="xx.jsp?backurl="+window.location.href;
</script>
另外一種:
<script language="javascript">
alert("返回");
window.history.back(-1);
window.history.go(-1)。
</script>
第三種:
<script language="javascript">
window.navigate("xx.jsp");
</script>
第四種:
<script language="JavaScript">
self.location=‘xx.htm‘;
</script>
第五種:
<script language="javascript">
alert("非法訪問!");
top.location=‘xx.jsp‘;
</script><span style="font-size:13px;color:black;"></span>
總結:
self:當前表單對象(假設是在iframe裡,則為該架構的表單對象)
top:父表單對象
window:典型情況下,瀏覽器會為每個開啟的html建立相應的window對象,假設這個文檔包括了多個架構,則瀏覽器會為原始文檔建立一個window對象。再為每個架構建立額外的window對象。能夠再當前表單中直接使用window的所有屬性、方法和集合,即不須要在前面附加計算結果為當前window對象的運算式。儘管window能夠省略。可是為了方便閱讀以及避免一些漏洞,一般都使用這個keyword。
location:該對象包括當前url資訊,擁有多個屬性。預設屬性為 location.href,表示整個url,即假設設定location="http://www.ddd.cn",則等同於location.href="http://www.ddd.cn".self:當前表單對象(假設是在iframe裡,則為該架構的表單對象)
window.navigate("http://xx.html/") 這種方法是僅僅針對IE的。不適用於Firefox等其它瀏覽器,在HTML DOM Window Object中,根本沒有列出window.navigate這種方法,所以這種方法盡量少用。
window.location 屬性是相容全部瀏覽器的。
因此在實現頁面跳轉的時候這個比較經常使用。
window.history.go(-1)是返回上一頁
window.location.go(-1) 是重新整理上一頁
js實現頁面跳轉的幾種方式