在html后面拼接字符串后页面的跳转


我就举一个简单的栗子,主要目的是实现页面跳转时后面获取的参数

<div class="active">
            点击我可以跳转
        </div>

样式就随便写一下   

之后主要是后面的 js

function jump(res){
            console.log(window.location);
            var mpt =window.location.search.substr(7,1);
            console.log(mpt);
            var opt=window.location.search.substr(-1);
            console.log(window.location.search.substr(-1));
            $(".active").click(function(){
                window.location.href="xxxxx.html?opt=" + opt +"&mpt="+mpt
                
            })
        }
            jump();

之后你所跳转的页面也就加上了后面的参数

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM