html跳页面传值

时间:2021-07-04 23:54:31

从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页面传入的值