zoukankan      html  css  js  c++  java
  • 获取用户地理位置.html

    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="UTF-8">
            <title></title>
            <style type="text/css">
                #div1{
                    height: 2000px;
                    background: pink;
                }
                #div2{
                    height: 500px;
                    background: skyblue;
                }
            </style>
        </head>
        <body>
            <!--<a href="#div2"></a>-->
            <button>百度</button>
            <button class="btn2">跳转到div2</button>
            <button class="back">back</button>
            <button class="qianjin">前进</button>
            <div id="div1">
                
            </div>
            <div id="div2">
                
            </div>
            <script type="text/javascript">
    //            navigator.geolocation.getCurrentPosition(function(e){
    //                console.log(e)
    //            },function(err){
    //                console.log(err)
    //            })
    
    
                document.querySelector('button').onclick = function(){
                    location.href = 'http://www.baidu.com'
        }
                
                document.querySelector('.btn2').onclick = function(){
                    location.hash = '#div2'
                }
                
                
                document.querySelector('.back').onclick = function(){
                    //history.go可以前进和后退。并且可以前进或者是后退几步,前进是正值,后退是负值
    //                history.go(-1)
                    history.back()
                }
                
                document.querySelector('.qianjin').onclick = function(){
                    history.forward()
                }
                
            </script>
        </body>
    </html>
  • 相关阅读:
    hdu 2546 饭卡
    poj 2262 Goldbach's Conjecture
    poj 1287 Networking
    poj 2377 Bad Cowtractors
    poj 1789 Truck History
    poj 2349 Arctic Network
    poj 1258 Agri-Net
    acdream 20140730 D题
    hdu 1012 素数判定
    hdu 2098 分拆素数和
  • 原文地址:https://www.cnblogs.com/wwthuanyu/p/10555256.html
Copyright © 2011-2022 走看看