PDA

View Full Version : send values to media elements



riptide
06-01-2007, 02:36 PM
sending a value to a media player.

if you have the media player in your page windows media player or quicktime.

to send a value from a link put in a variable; how do you send it in a cross browser script to the embed src and the object tags param. I have read that there are problems with send things to param

do you need to use :
function{
var newValue= link1.herf or link1.valuenew

O.newP.value=newValue
or
newP.value=newValue

and for the embed element is it: newO.newE.value=newValue or

newO.newE.src=newValue
or
newE.value=newValue
or
newE.src=newValue


<body>
<a id="link1" herf="" retuen false>click here</a>
<object id="newO"
<param id="newP" name="" value=""/>
<embed id="newE" src=""/>
</object>

riptide
06-02-2007, 04:18 PM
if you are confused just ask me what I mean?

mburt
06-02-2007, 05:34 PM
Okay... What do you mean? I think you're talking about change param attributes?

riptide
06-02-2007, 08:22 PM
yeah I want to send a value to them; a value from a link but I don't know who to do it. I also want to send the vaule of the link to the src of the embed tag.

mburt
06-02-2007, 10:54 PM
Use this to access it:

document.embeds["newE"]
and if you want to change an attribute:

document.embeds["newE"]["src"] = "new source";

riptide
06-03-2007, 05:27 PM
okay thanks but if I wanted to get to the param element of the object tag. what do I do.

also do you get the href value by going var nelo= link.href

and I'm having a bit of trouble with return false on links; it never seems to work.

mburt
06-03-2007, 06:57 PM
The object tag is not an attribute of the param tag... I think you are getting something confused here. Could you explain a bit more?

riptide
06-03-2007, 07:06 PM
like if I have
<object id="Player" width="300" height="450"
classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">
<param name="fileName" value="">
</object>>
I'm trying to send a value from a link to the param's value.

someone said to just use Player.filename=newvalue
but I don't understand how to get the links href value the right way.

mburt
06-03-2007, 07:12 PM
Check which number the param number is on the page starting at zero and use the following:

document.getElementsByTagName("param")[0].value = "NEW VALUE"
I'm not sure if JS is allowed to access flash objects though.

riptide
06-03-2007, 07:25 PM
I'm not going to use flash. can you add an ID to the param to get it easier.

mburt
06-03-2007, 07:32 PM
No, ID is not a valid param tag, but the method above will work fine.

riptide
06-03-2007, 07:50 PM
oh okay. but to get the links value in to a varibale; what do it do. is it the value of the link or the href