0

I'm trying to change an object's parameter when the user clicks a link on the site which would reference another video.

HTML

<object id="myExperience8675309" class="BrightcoveExperience">
  <param name="bgcolor" value="#FFFFFF" />
  <param name="width" value="480" />
  <param name="height" value="270" />
  <param name="playerID" value="123456789" />
  <param name="playerKey" value="abcdefghijklmnop" />
  <param name="isVid" value="true" />
  <param name="isUI" value="true" />
  <param name="dynamicStreaming" value="true" />
  <param name="@videoPlayer" value="8675309" />
</object>

I'm not sure how to access the parameters of the object via an onClick function. I want to change the @videoPlayer value. Suggestions?

3 Answers 3

1

Using foo as an arbitrary trigger element:

var foo = document.getElementById('foo');
foo.onclick = function () {
    document.getElementsByName('@videoPlayer')[0].value='123456';
}

jsFiddle example

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I was stuck on trying to access the object and then change the parameter and then the subsequent value. I'll give it a shot and if it works I'll be back to vote you up.
0

you create a function in javascript that will go,

document.getElementsByName('@videoPlayer').value='New Value';

Comments

0

If you have document.querySelector support (IE8+, at least for CSS2 selectors), you can use an attribute selector to get the parameter you want:

button = document.querySelector('button'); // <button> element
button.addEventListener('click', function(){
    var param = document.querySelector('[name="height"]'); // can use '#objectid [name="height"]' for greater specificity
  param.value = 100;

});

jsbin

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.