在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