Call a video with jscript-function

R

Ruppen Pascal

I have a problem. My function is this

function loadMovie(value){
document.getElementById("VideoID").innerHTML="<OBJECT ID=\"video\"
width=\"240\" height=\"180\"
classid=\"CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95\"

CODEBASE=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf
..cab#Version=6,4,5,715\" standby=\"Loading Microsoft® Windows® Media Player
components...\" type=\"application/x-oleobject\">"+

"<PARAM NAME=\"AutoStart\" VALUE=\"True\">"+
"<PARAM NAME=\"FileName\"
VALUE=\"http://winmedia.com/clip_"+value+".wmv\">"+
"<PARAM NAME=\"ShowControls\" VALUE=\"False\">"+
"<PARAM NAME=\"ShowStatusBar\" VALUE=\"False\">"+
"<PARAM NAME=\"AutoSize\" VALUE=\"False\">"+
"<PARAM NAME=\"SendPlayStateChangeEvents\" VALUE=\"True\">"+

"<EMBED TYPE=\"application/x-mplayer2\"
SRC=\"http://winmedia.com/clip_"+value+".wmv\" WIDTH=\"240\" HEIGHT=\"180\"
ShowControls=0>"+
"</EMBED> </OBJECT>";
}

The problem is now that the MediaPlayer logo is showing but the movie don't
start??? If I use

document.write("<OBJECT ID=\"video\" width=\"240\...)

that's no problem. The movie run. But I will integrate the movie in my page
and then I needed document.getElementById("VideoID")...

You have solutions

Thank and regards
 
T

Thomas 'PointedEars' Lahn

Ruppen said:
function loadMovie(value){
document.getElementById("VideoID").innerHTML="<OBJECT ID=\"video\"
^^^^^^^^^^^^^^ ^^^^^^^^^
You are mixing two DOMs (W3C-DOM and DOM-0) without checking for
either one. That is a Bad Thing, see other discussions here.
width=\"240\" height=\"180\"
classid=\"CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95\"

To make your source code easier legible, use ' as separators for attribute
strings or use " for the attribute and ' for the JavaScript string separators.
[...]
The problem is now that the MediaPlayer logo is showing but the movie don't
start??? If I use

document.write("<OBJECT ID=\"video\" width=\"240\...)

that's no problem. The movie run. But I will integrate the movie in my page
and then I needed document.getElementById("VideoID")...

I do not see why that is required when document.write(...) will do the trick.
You have solutions

Is that a question?
^
Simplifying your code and not mixing the DOMs as described above is the
first step in debugging that. Using the JavaScript console in Mozilla/5.0
and enable the display of script errors in IE is another.


HTH

PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top