JavaScript 跳轉 常用代碼

按鈕式:

  <INPUT name="pclog" type="button" value="GO" onClick="location.href='http://9ba.cn/'">

  鏈接式:

  <a href="javascript:history.go(-1)">返回上一步</a>

  <a href="<%=Request.ServerVariables("HTTP_REFERER")%>">返回上一步</a>

  直接跳轉式:

  <script>window.location.href='http://www.9ba.cn';</script>

  開新窗口:

  <a href="javascript:" onClick="window.open('http://www.9ba.cn/post/235.html','','height=500,width=611,scrollbars=yes,status=yes')">雲上的日子</a>

 

=====javascript中彈出選擇框跳轉到其他頁面=====
<script language="javascript">
<!--
function logout(){
if (confirm("你確定要註銷身份嗎?/n是-選擇確定,否-選擇取消")){
window.location.href="logout.asp?act=logout"
}
}
-->
</script>

 

=====javascript中彈出提示框跳轉到其他頁面=====
<script language="javascript">
<!--
function logout(){
alert("你確定要註銷身份嗎?");
window.location.href="logout.asp?act=logout"
}
-->
</script>

=====Html中確認後彈出新頁面===========
function Del(id)
  {
if (confirm("你確定要刪除嗎?"))
  {
  window.open("otherfile.asp?ID="+id+"&act=del","top","width=640,height=400")
  }
  }

=====Html中確認後跳轉到其他頁面=========
function Del(URL)
  {
if (confirm("你確定要刪除嗎?"))
  {
  //URL="otherfile.htm"
  window.location.href=URL
  }
  }

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章