這不起作用,我得到一個JavaScript錯誤,指出我缺少一個;。有沒有更好的方法,我應該混合變量與HTML?帶有混合變量的字符串
var video_html = '<video id="video-tag" width="640" height="480" poster="' + filePath + fileImage + '" controls="controls" preload="none">\
<!-- MP4 for Safari, IE9, iPhone, iPad, Android, and Windows Phone 7 -->\
<source id="source-mp4" type="video/mp4" src="' + filePath + fileMP4 + '" />\
<!-- WebM/VP8 for Firefox4, Opera, and Chrome -->\
<source id="source-webm" type="video/webm" src="' + filePath + fileWebM + '" />\
<!-- Flash fallback for non-HTML5 browsers without JavaScript -->\
<object width="640" height="480" type="application/x-shockwave-flash" data="flashmediaelement.swf">\
<param name="movie" value="build/flashmediaelement.swf" />\
<param id="flashvars-param" name="flashvars" value="controls=true&poster=' + filePath + fileImage '&file=' + filePath + fileMP4 + '" />\
<!-- Image as a last resort -->\
<img id="fallback-image" src="' + filePath + fileImage + '" width="640" height="480" title="No video playback capabilities" />\
</object>\
</video>';
我終於做了這樣的事情。
$("#video-wrap").empty().append(video_html);
我覺得這是荒謬的。謝謝! –