Is it possible to change the file path of the video using javascript?

戏子无情 提交于 2019-12-11 16:19:57

问题


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?


回答1:


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?



来源:https://stackoverflow.com/questions/2857381/is-it-possible-to-change-the-file-path-of-the-video-using-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!