JavaScript change "element" of and OBJECT (html tag)

D

dkl1

Hi,

I have the following HTML code (for playing a WAV sound file):
<OBJECT ID=vidCtrl_success
CLASSID="CLSID:05589FA1-C356-11CE-BF01-00AA0055595A"
STYLE="display:none" VIEWASTEXT>
<PARAM NAME="FileName" VALUE="MySong1.wav">
</OBJECT>

I have in the same dir several files, which I named:
MySong1.wav, MySong2.wav, MySong3.wav, ...etc.

=> I want to load a random file each time the page is visited (by
dynamically changing th above OBJECT).

How can I accomplish this?

TIA.
 
S

Smarty

Hi,

Hope you going to work with dir structure using any of the Server
scripts (PHP,ASP, JSP, etc.,). So each time u take the random file path
using any of the Server scripts and write the name in the VALUE
attribute.

PHP EX:

<OBJECT ID=vidCtrl_success
CLASSID="CLSID:05589FA1-C356-11CE-BF01-00AA0055595A"
STYLE="display:none" VIEWASTEXT>
<PARAM NAME="FileName" VALUE="<?=$fname?>">
</OBJECT>

If you not using any Server Scripts, then you want to be sure about the
file name's consistency. The file's name should end with a unique
number. Then you want to generate a random number and concade the value
in the VALUE attribute. This is a UGLY method, bec if the random number
generated as MySong76.wav and if that file was not there then, no song
will be played.

Regards,

M. Sriram
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top