Re: [問題] javascript 取得播放影片長度
※ 引述《buganini (霸格尼尼)》之銘言:
: ※ 引述《hera1016 ()》之銘言:
: : 可是如果我是在html裡面embed object就不會有這個問題 囧a
: 因為...
: '='會覆蓋整個innerHTML
: 並非append
: 應該先拿一個字串裝好全部的html再一口氣塞進去
: 也不要分次用+=
: 因為可能你放前面一段的時候會造成html parse錯誤
: 流程就中斷了
: 沒加</object>可以放是因為
: innerHTML的內容是<embed>那行
附議bug的說法,另外提供個人比較喜歡用的字串組裝處理法。
先用array裝起來 然後再用join一次組合起來
會比分次的字串+=省時省力
var objStr=[];
objStr.push( "<object id='MediaPlayer' width=544 height=432");
objStr.push( "classid='CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95'");
objStr.push("standby='Loading Windows Media Player components…'");
objStr.push( "type='application/x-oleobject'");
objStr.push("codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112'>");
objStr.push("<param name='filename' value='magic.wmv'>");
objStr.push("<param name='autoStart' value='True'>");
objStr.push("<embed type='application/x-mplayer2' src='magic.wmv' );
objStr.push("name='MediaPlayer' width=544 height=432></embed>");
show_file.innerHTML = objStr.join("");
--
I am a person, and I am always thinking .
Thinking in love , Thinking in life ,
Thinking in why , Thinking in worth.
I can't believe any of what ,
I am just thinking then thinking ,
but worst of all , most of mine is thinking not actioning...
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 125.232.4.89
→
03/18 22:34, , 1F
03/18 22:34, 1F
噓
03/20 11:32, , 2F
03/20 11:32, 2F
→
03/20 11:32, , 3F
03/20 11:32, 3F
→
03/20 11:32, , 4F
03/20 11:32, 4F
推
03/20 11:36, , 5F
03/20 11:36, 5F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章