刘小帅

渠道包
html获取参数对应不同下载链接</head> <script> cons...
扫描右侧二维码阅读全文
17
2020/02

渠道包

html获取参数对应不同下载链接

</head>
    <script>
    const c = getQueryString("c");
    function getQueryString(name) {
            let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
            let r = window.location.search.substr(1).match(reg);
            if (r != null) {
                return unescape(r[2]);
            };
            return null;
        }

    function ANDDownSoft() {
            if(c == null) {
                window.location.href = "下载链接";
            } else if (c == "9PVHH") {
                window.location.href = "下载链接";
            } else {
                window.location.href = "下载链接";
            }
        }
    function IOSDownSoft() {
        if(c == null) {

                window.location.href = "下载链接";

            } else if (c == "9PVHH") {

                window.location.href = "下载链接";
            } else{
                window.location.href = "下载链接";
            }
        }

    </script>

调用

<div class="btn">
                    <a onclick="IOSDownSoft();"><img src="static/picture/btn.png" alt=""></a>
</div>

h5展示三条 获取参数 跳转


        <div class="tzbox" >
            <div class="btn1">
                <span class="zdy">站点一</span><a class="ym1">3333.com</a><a class="djjr1" onclick="zdydownload();" target="_blank">点击进入</a>
            </div>
            <div class="btn2">
                <span class="zde">站点二</span><a class="ym2">2222.com</a><a class="djjr2" onclick="zdedownload();"  target="_blank">点击进入</a>
            </div>
            <div class="btn3">
                <span class="zds">站点三</span><a class="ym3">1111.com</a><a class="djjr3" onclick="zdsdownload();" target="_blank">点击进入</a>
            </div>



        <script>
        function zdydownload(){
            var url =  'https://3333.com/register.html' +document.location.search;
            console.log(url);
            window.open(url);
        }
        function zdedownload(){
            var url =  'https://2222.com/register.html' +document.location.search;
            console.log(url);
            window.open(url);
        }
        function zdsdownload(){
            var url =  'https://1111.com/register.html' +document.location.search;
            console.log(url);
            window.open(url);
        }
    </script>
</body>

</html>

Last modification:February 17th, 2020 at 08:53 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment