【问题标题】:pass variable from url to flowplayer将变量从 url 传递到 flowplayer
【发布时间】:2013-01-25 21:05:29
【问题描述】:

我正在尝试从我的 url 中读取变量并将它们传递给 flowplayer。例如,如果我的链接是: "http://someurl/flowplayer.html?video=mymovie.mp4&time=180"

我想使用视频变量和时间变量创建视频 src 链接。我尝试使用 javascript,但出现错误。

【问题讨论】:

    标签: javascript url flowplayer


    【解决方案1】:

    我使用这个函数从 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..
    

    【讨论】:

    猜你喜欢
    • 2014-01-22
    • 1970-01-01
    • 1970-01-01
    • 2021-06-28
    • 1970-01-01
    • 2011-05-02
    • 2013-09-14
    • 2012-11-06
    • 1970-01-01
    相关资源
    最近更新 更多