是否可以使用javascript更改视频的文件路径?
我的 HTML 文件中有一个对象标记:
<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95">
<param name="FileName" value="../ABC/WildLife.wmv" id="mediaPlayerFile">
<param name="AutoStart" value="false" />
</object>
我想使用 javascript 更改文件名。
到目前为止我所得到的是:
<script type="text/javascript">
function disp_current_directory() {
var val = document.getElementById('mediaPlayerFile');
val.attributes['value'].value = "D:\XYZ\WildLife.wmv";
}
</script>
但这不起作用。 :(
有可能吗?如果有,怎么办?
I have an object tag in a HTML file:
<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95">
<param name="FileName" value="../ABC/WildLife.wmv" id="mediaPlayerFile">
<param name="AutoStart" value="false" />
</object>
I want to change the filename using javascript.
What I have so far is this:
<script type="text/javascript">
function disp_current_directory() {
var val = document.getElementById('mediaPlayerFile');
val.attributes['value'].value = "D:\XYZ\WildLife.wmv";
}
</script>
But this doesn't work. :(
Is it possible? If yes, how?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法在对象初始化后执行此操作,因为使用
提供的参数仅在对象创建期间使用。要更新此内容,您必须用新参数替换整个
object
标记。如果你想访问对象的api,请看一下这个问题 Windows Media Player 是否有记录的 JavaScript API?
You cannot do this after the object has been initialized as the parameters supplied using
<param..>
are only used during object creation.To update this you will have to replace the entire
object
tag with new parameters.If you want to access the api of the object, take a look at this question Is there a documented JavaScript API for Windows Media Player?