我想使用 jquery 将所有“替换”字符串替换为某个字符串,同时保留所有扩展名(.jpg、.mp4、...)。这是我的尝试:
<video id="test" controls="controls" poster="replace.jpg" width="640" height="360">
<source src="replace.mp4" type="video/mp4" />
<source src="replace.webm" type="video/webm" />
<source src="replace.ogg" type="video/ogg" />
<object type="application/x-shockwave-flash" data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" width="640" height="360">
<param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" />
<param name="allowFullScreen" value="true" />
<param name="wmode" value="transparent" />
<param name="flashVars" value="config={'playlist':['replace.jpg',{'url':'replace.mp4','autoPlay':false}]}" />
<img alt="Test Video" src="replace.jpg" width="640" height="360" title="No video playback capabilities, please use a better browser." />
</object>
</video>
和脚本:
var src = "content/test";
$("#test").replace(/replace/g , src);