469,898 Members | 1,605 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

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

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.

Jan 25 '07 #1
2 2207
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

On Jan 25, 1:48 pm, "dkl1" <liordek...@gmail.comwrote:
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.
Jan 26 '07 #2
Thanks!

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
Jan 28 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by Barry | last post: by
reply views Thread by maersa | last post: by
4 posts views Thread by jaime.dyson | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.