【发布时间】:2013-01-25 21:05:29
【问题描述】:
我正在尝试从我的 url 中读取变量并将它们传递给 flowplayer。例如,如果我的链接是: "http://someurl/flowplayer.html?video=mymovie.mp4&time=180"
我想使用视频变量和时间变量创建视频 src 链接。我尝试使用 javascript,但出现错误。
【问题讨论】:
标签: javascript url flowplayer
我正在尝试从我的 url 中读取变量并将它们传递给 flowplayer。例如,如果我的链接是: "http://someurl/flowplayer.html?video=mymovie.mp4&time=180"
我想使用视频变量和时间变量创建视频 src 链接。我尝试使用 javascript,但出现错误。
【问题讨论】:
标签: javascript url flowplayer
我使用这个函数从 JavaScript 中的 url 读取参数:
function getParam( sParamName ){
sLocation = location.href;
aLCQS = sLocation.split("?");
if (aLCQS.length > 1){ // there are a querystring
aParams = aLCQS[1].split("&");
for( f=0; f<aParams.length; f++ ){
aParam = aParams[f].split("=");
if( aParam[0] == sParamName ){
return aParam[1]; // return the value
}
}
}
}
使用方法:
video=getParam("video");
time=getParam("time");
// do what you want..
【讨论】: