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.οnlοad=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.οnlοad=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>

 

转载于:https://www.cnblogs.com/wudage/p/10082656.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值