首页 > 技术文章 > html跳页面传值

ljknlb 2017-08-28 13:03 原文

 

从a.html跳转到b.html并且把a.html的值name传入b.html 

  在a.html页面,url路径后面带参数,参数与url之间用?隔开

window.location.href = "a.html?name='kevin";

在b.html页面编写

        <script>    
        var thisURL = document.URL; 
        var getval =thisURL.split('?')[1]; 
        var showval= getval.split("=")[1]; 
        </script>

showval获取的就是从a.html页面传入的值

推荐阅读