2012-05-17 27 views
0

我想在爲用戶發佈視頻之前爲我的視頻獲取預覽系統,因爲我需要能夠從數據庫檢索多個文件並相應地創建視頻。我有一個按鈕變量在JS中傳遞的問題,視頻幻燈片

<a class="btnGray clickable floatRight" style="position:relative;" onclick="startVideo('<?=$content[ReleaseSystem::contentID]?>','<?=$video['filename']?>');"><?=$lang[109]?></a> 

此按鈕鏈接到下面的函數

​​

現在奇怪的是,視頻播放器加載時我沒有穿過我的按鈕,鏈接,但是當我嘗試發送一個鏈接整個功能分解。我不知道爲什麼會發生。

也在這裏是玩家

<div id="videoFlyout<?=$content[ReleaseSystem::contentID]?>" class="popUpWrapper" style="display:none;position:absolute;top:10px;left:auto;"> 
    <div class="firstPopupDiv" style="left:center;height:425px;width:620px;"> 
     <div class="popupDivInner" style="display:block;" class="hideSteps"> 
      <div id="<?=$content[ReleaseSystem::contentID]?>"> 
       <center><a id="player" style="display:block; height:365px; width:620px;"></a></center> 
      </div> 
      <a class="btnRed clickable floatRight" style="position:relative;" onclick="closeVideo(<?=$content[ReleaseSystem::contentID]?>);"><?=$lang[109]?></a> 
      <a class="btnGray clickable floatRight" style="position:relative;" onclick="startVideo('<?=$content[ReleaseSystem::contentID]?>','<?=$video['filename']?>');"><?=$lang[109]?></a> 
     </div> 
    </div> 
</div> 

這裏我的HTML代碼是我的渲染HTM

<div id="videoFlyout280" class="popUpWrapper" style="position: absolute; top: 10px; left: auto; display: none;"> 
    <div class="firstPopupDiv" style="left:center;height:425px;width:620px;"> 
     <div class="popupDivInner" style="display:block;"> 
      <div id="280" style=""> 
      <center> 
      <a id="player" style="display:block; height:365px; width:620px;"> 
       <object id="player_api" width="100%" height="100%" type="application/x-shockwave-flash" data="players/nobranding.swf"> 
        <param value="true" name="allowfullscreen"> 
        <param value="always" name="allowscriptaccess"> 
        <param value="high" name="quality"> 
        <param value="false" name="cachebusting"> 
        <param value="#000000" name="bgcolor"> 
        <param value="opaque" name="wmode"> 
        <param value="config={"clip":{"autoPlay":true},"playlist":[{"url":"videos/IMPORTS/video_1011_281_1337198589_VID_20120511_00000.3GP","autoPlay":true}],"plugins":{"controls":{"playlist":true}},"playerId":"player"}" name="flashvars"> 
       </object> 
      </a> 
      </center> 
     </div> 
     <a class="btnRed clickable floatRight" onclick="closeVideo(280);" style="position:relative;">Cancel</a> 
     <a class="btnGray clickable floatRight" onclick="startVideo('280','video_1011_280_1337183112_testCat.mp4');" style="position:relative;">Cancel</a> 
     </div> 
    </div> 
</div> 
<div id="videoFlyout281" class="popUpWrapper" style="position: absolute; top: 10px; left: auto;"> 
    <div class="firstPopupDiv" style="left:center;height:425px;width:620px;"> 
     <div class="popupDivInner" style="display:block;"> 
      <div id="281" style=""> 
      <center> 
       <a id="player" style="display:block; height:365px; width:620px;"> </a> 
      </center> 
      </div> 
      <a class="btnRed clickable floatRight" onclick="closeVideo(281);" style="position:relative;">Cancel</a> 
      <a class="btnGray clickable floatRight" onclick="startVideo('281','video_1011_281_1337198589_VID_20120511_00000.3GP');" style="position:relative;">Cancel</a> 
     </div> 
    </div> 
</div> 
+0

注意:也許重新考慮使用[PHP的短標籤](http://stackoverflow.com/a/200666/633656),一定要閱讀所有的評論,因爲它不是一個簡單的答案,只是「把它變成」。更多關於「關閉,如果...」 – Recognizer

回答

0

它很難說究竟是什麼沒有錯誤消息和呈現的HTML發生,但一個突出的東西是startVideo(<?=$video['filename']?>);應該是startVideo('<?=$video['filename']?>');,它看起來像你的意思是傳遞一個字符串,並且你傳遞JavaScript解釋爲undefined全局變量。

如果這能解決您的問題,那就太棒了!否則張貼上述項目進一步調查。

+0

好吧,所以我現在就接受你的建議我在加載頁面時彈出一個視頻加載了最後一個視頻,當我點擊我的加載按鈕時,它只加載第一個視頻幻燈片hmm。原因之前,我使用html嵌入它的工作,但我有一個IE問題,它不會關閉播放器,所以我不得不改變它爲這種格式。順便說一句,沒有我收到的錯誤消息,這使得它更令人困惑。 – MDInzee

+0

作爲一個方面說明,您需要使用'closeVideo' JS函數完成上述操作。你可以發佈相關的呈現HTML,也就是說,當你做一個查看源代碼的HTML嗎? – marteljn

+0

你的關閉函數需要一個數字還是一個字符串?你傳遞它的方式,JS會將它解釋爲一個數字,除非你像引用函數一樣將它放在引號中。 – marteljn