• js获取URL请求参数与改变src


    js实现:

    <script>
    function GetQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if(r != null) return unescape(r[2]);
    return null;
    }

    window.onload=function() {
    var img=document.getElementById("type");

    img.setAttribute("src","img/tiche/"+GetQueryString("carmodel")+".jpg");
    }

    </script>
    <div style="margin-top:40px">
    <img src="" width="100%">
    <img src="" width="100%">
    <img id="type" src="" width="100%">
    </div>

    <html>
    <head>
    <meta name="renderer" content="ie-stand|ie-comp|webket">
    <meta http-equiv="X-UA-Compatible" content="IE=8,IE=9,IE=10" />
    <script type="text/javascript">

    window.onload=function(){
    var codeId = GetQueryString('id');
    // alert(codeId);
    var img=document.getElementById("wu");
    img.setAttribute("src","http://10.0.1.9:6713/mag/hls/"+codeId+"/0/live.m3u8");

    var player = videojs("example-video");
    player.play();
    }
    </script>
    <SCRIPT>
    function GetQueryString(name)
    {
    var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if(r!=null)return unescape(r[2]); return null;
    }
    </SCRIPT>
    <link href="/cxfvp/static/css/video-js.css" rel="stylesheet" type="text/css">
    <script src="/cxfvp/static/js/video.min.js" type="text/javascript"></script>
    <script src="/cxfvp/static/js/videojs-contrib-hls.js" type="text/javascript"></script>
    </head>
    <body>
    <table id="contentTable" class="table table-striped table-bordered table-condensed">
    <thead>
    <tr>
    <th>视频</th>
    </tr>
    </thead>
    <tbody>
    <tr>
    <td>
    <video id="example-video" class="video-js"
    width="1200" height="750" >
    <source id="wu" src="http://10.0.1.9:6713/mag/hls/codeId/0/live.m3u8" type="application/x-mpegURL">
    </video>
    </td>
    </tr>
    </tbody>
    </table>
    </body>
    </html>

  • 相关阅读:
    Codeforces Round #541 (Div. 2) D 并查集 + 拓扑排序
    Educational Codeforces Round 60 D dp + 矩阵快速幂
    Educational Codeforces Round 60 C 思维 + 二分
    Codeforces Round #544 (Div. 3) dp + 双指针
    Codeforces Round #542(Div. 2) CDE 思维场
    UVA
    UVA
    UVA
    UVA
    UVA
  • 原文地址:https://www.cnblogs.com/wudage/p/10082656.html
Copyright © 2020-2023  润新知