是否可以使用javascript更改视频的文件路径?

发布于 2024-09-01 14:47:10 字数 617 浏览 1 评论 0原文

我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我恋#小黄人 2024-09-08 14:47:10

您无法在对象初始化后执行此操作,因为使用 提供的参数仅在对象创建期间使用。

要更新此内容,您必须用新参数替换整个 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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文