/    Sign up×
Community /Pin to ProfileBookmark

InnerHTML and Firefox with Object

Hi,

I am having a real problem getting this to work in firefox. It works great in IE, but firefox doesn’t want to even recognize my code.

Basically, I have an object, param and embed tags for a windows media player that is being sent to an div via innerhtml. All I really want to do it send a different wmv files to the player when the user clicks on a link. I am using an XML file to create the links, and there is an onclick event that triggers a javascript event. In this event I am sending the innerhtml with a new Object and Embed tags with the src/url of that wmv.

I tried to send it via the following code, but it did not see this either. It all works in IE, just not in firefox.

[code]
parent.document.getElementById(‘videoembed’).url= source;
[/code]

This is the procedure that is sending the innerhtml code.

[code]
function playvideo(source) {
//parent.document.getElementById(‘videoembed’).url= source;
var b = ‘<OBJECT id=”videoembed2″ name=”videoembed2″ width=”500″ height=”445″ classid=”CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6″ type=”application/x-oleobject”><PARAM NAME=”URL” VALUE=”‘ + source + ‘”></PARAM><PARAM NAME=”enabled” VALUE=”True”></PARAM><PARAM NAME=”AutoStart” VALUE=”True”></PARAM><PARAM name=”PlayCount” value=”3″></PARAM><PARAM name=”Volume” value=”30″></PARAM><PARAM NAME=”balance” VALUE=”0″></PARAM><PARAM NAME=”Rate” VALUE=”1.0″></PARAM><PARAM NAME=”Mute” VALUE=”False”></PARAM><PARAM NAME=”fullScreen” VALUE=”False”></PARAM><PARAM name=”uiMode” value=”full”></PARAM><PARAM NAME=”EnableFullScreenControls” VALUE=”True”></PARAM><PARAM NAME=”BufferingTime” VALUE=”5″></PARAM><PARAM NAME=”AllowChangeDisplaySize” VALUE=”False”></PARAM><PARAM NAME=”AutoRewind” VALUE=”True”></PARAM><PARAM NAME=”BaseURL” VALUE=””></PARAM><PARAM NAME=”stretchToFit” VALUE=”True”></PARAM><EMBED type=”application/x-mplayer2″ pluginspage=”http://microsoft.com/windows/mediaplayer/en/download/” id=”videoembed” name=”videoembed” displaysize=”4″ autosize=”-1″ bgcolor=”darkblue” showcontrols=”true” showtracker=”-1″ showdisplay=”0″ showstatusbar=”-1″ videoborder3d=”-1″ width=”500″ height=”445″ autostart=”false” designtimesp=”5311″ loop=”false” src=”‘ + source + ‘”></EMBED></OBJECT>’;

alert(b);
parent.document.getElementById(‘divvideo’).innerHTML = b;
}
[/code]

When I run the page in IE, the video comes up just fine, when I run the code in Firefox, the code alerts with an empty alert box, and nothing happens. If I put some text before the tags, I see the text, but nothing else, and the div shows these word, but nothing else happens and the video player does not appear.

I do not know what I am doing wrong. Please HELP!!!

Thanks!!!

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@samdayeauthorMay 01.2009 — Hi, I am trying to send a url or a src of a wmv file to a video player when my user clicks on that video file link. The list of video files is created by an XML page that is placed in an iframe on my webpage. When the user clicks the link the onclick is triggered and the url is set for the OBJECT tag of the video player. This works great in IE, but I cannot get it to work in Firefox.

In looking around on the internet I saw that maybe I should use a DIV and send the innerhtml for that div and populate it with a new Object and Embed tag each time that the user clicks the links and that way the object and the embed tags have their video files. I did this, and I still have no luck on firefox. I can see that on firefox that the function is firing because the alert is coming up, but the alert box is empty, where on IE it shows me all the contents of the innerhtml.

See the code below of the script. I originally just had the parent.document.getElementById firing and that worked in IE, but not in firefox. Any help to get the url or src changing in firefox would be great!!!

function playvideo(source) {

//parent.document.getElementById('videoembed').url= source;

var b = source + 'here3<OBJECT id="videoembed2" name="videoembed2" width="500" height="445" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject"><PARAM NAME="URL" VALUE="' + source + '"></PARAM><PARAM NAME="enabled" VALUE="True"></PARAM><PARAM NAME="AutoStart" VALUE="True"></PARAM><PARAM name="PlayCount" value="3"></PARAM><PARAM name="Volume" value="30"></PARAM><PARAM NAME="balance" VALUE="0"></PARAM><PARAM NAME="Rate" VALUE="1.0"></PARAM><PARAM NAME="Mute" VALUE="False"></PARAM><PARAM NAME="fullScreen" VALUE="False"></PARAM><PARAM name="uiMode" value="full"></PARAM><PARAM NAME="EnableFullScreenControls" VALUE="True"></PARAM><PARAM NAME="BufferingTime" VALUE="5"></PARAM><PARAM NAME="AllowChangeDisplaySize" VALUE="False"></PARAM><PARAM NAME="AutoRewind" VALUE="True"></PARAM><PARAM NAME="BaseURL" VALUE=""></PARAM><PARAM NAME="stretchToFit" VALUE="True"></PARAM><EMBED type="application/x-mplayer2" pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" id="videoembed" name="videoembed" displaysize="4" autosize="-1" bgcolor="darkblue" showcontrols="true" showtracker="-1" showdisplay="0" showstatusbar="-1" videoborder3d="-1" width="500" height="445" autostart="false" designtimesp="5311" loop="false" src="' + source + '"></EMBED></OBJECT>';

alert(b);
parent.document.getElementById('divvideo').innerHTML = b;
}



Thanks for your help!!!
×

Success!

Help @samdaye spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...