zoukankan      html  css  js  c++  java
  • 10.跳转

    1.<a href="http://www.baidu.com">a标签.baidu.com</a>
    2.
      <a href="javascript:;" onclick="openurl()" >js跳转.baidu.com</a>  
      function openurl(){
         window.location.href="http://www.baidu.com"
      }
    3.跳转新页面打开
          超链接<a href="http://www.jb51.net" title="脚本之家" target="_blank">Welcome</a>
          等效于js代码
          window.open("http://www.jb51.net"); 
    3.
        <head>  
        <!--只是刷新不跳转到其他页面 -->  
        <meta http-equiv="refresh" content="5">  
        <!--定时转到其他页面 -->  
        <meta http-equiv="refresh" content="5;url=index.html">   
        </head> 
    4.
      html跳转上一页的方式

        window.history.go(-1);或者window.history.back(-1);

            <a href=”#” onClick=”JavaScript :history.back(1);”>返回上一页</a>  
            <a href=”#” onClick=”javascript :history.Go(-1);”>返回上一页</a>  

        在javascript中写跳转上一页
            <div id="btn">按钮</div>  

        <script type="text/javascript">  
            var wrong = document.getElementById('btn');  
            wrong.onclick = function() {   
            window.history.go(-1);//返回上一页  
            window.history.back(-1);//返回上一页  
            }  
        </script> 
     
  • 相关阅读:
    js键盘事件以及键盘事件拦截
    JavaScript 延迟加载
    二叉树深度优先 求二叉树最大深度
    css 小知识点:inline/inline-block/line-height
    es6 set
    CSS 水平垂直居中
    js 位运算符
    js 函数重载
    js之单例模式
    js 面向对象 ES5 AND ES6
  • 原文地址:https://www.cnblogs.com/stone5/p/8998942.html
Copyright © 2011-2022 走看看