Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

choosing to play a sound ... please help !!

Status
Not open for further replies.

cram81

Technical User
Joined
Dec 27, 2003
Messages
29
Location
GB
if any one can help me with this problem I would be so grateful as Ive been stuck on it for over a week now ....

basically i want the user to select a file from a drop down box and then this will then pass the file name to the player which takes in filename as one its parameters...
i know the update needs to assigned to an onChange() handler but i dont know how to access the <objects> parameters....

heres my code.. ive tried writing a function which returns the string in the drop down box but i dont know how to pass it to the the objects parameters...

<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;>
<html><head>
<script language=&quot;JavaScript&quot;>
<!--

function changeFile(the_file)
{
var the_url = the file;
return the_url;

/*This is just returning a value but I
* want it to update the parameter &quot;FileName&quot; value
* to the item in the drop down box
*/
}
//-->
</script>
</head>
<body>

<h2>Playing The Object</h2>
<form name=&quot;the_form&quot;>
<select name=&quot;choose_file&quot;
onChange=&quot;changeFile(window.document.the_form.choose_file.
options[selectedIndex].text);&quot;>
<option selected>loop1.wav
<option>loop2.wav
</select><BR><BR><BR>

<object height=&quot;13.5%&quot; width=&quot;25%&quot; classid=&quot;clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95&quot; >
<param name=&quot;AutoStart&quot; value=&quot;1&quot; />
<param name=&quot;FileName&quot; value=&quot;loop1.wav&quot; />
// How do I access this value parameter above??
</object>
</body>

<script language=&quot;JavaScript&quot;>
<!--
window.open = SymRealWinOpen;
//-->
</script>
</html>

thanks

mark

 
how about assigning it an id, then use getElementById()

<param name=&quot;FileName&quot; value=&quot;loop1.wav&quot; id=&quot;file&quot;/>

<script>
var par = document.getElementById(&quot;file&quot;);
file.value = &quot;newFile.wav&quot;;
</script>

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
yeah thanks for your reply someone else suggested that as well and thank god it now works!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top