Call a video with jscript-function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ruppen Pascal

    Call a video with jscript-function

    I have a problem. My function is this

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

    CODEBASE=\"http ://activex.microso ft.com/activex/controls/mplayer/en/nsmp2inf
    ..cab#Version=6 ,4,5,715\" standby=\"Loadi ng Microsoft® Windows® Media Player
    components...\" type=\"applicat ion/x-oleobject\">"+

    "<PARAM NAME=\"AutoStar t\" VALUE=\"True\"> "+
    "<PARAM NAME=\"FileName \"
    VALUE=\"http://winmedia.com/clip_"+value+". wmv\">"+
    "<PARAM NAME=\"ShowCont rols\" VALUE=\"False\" >"+
    "<PARAM NAME=\"ShowStat usBar\" VALUE=\"False\" >"+
    "<PARAM NAME=\"AutoSize \" VALUE=\"False\" >"+
    "<PARAM NAME=\"SendPlay StateChangeEven ts\" VALUE=\"True\"> "+

    "<EMBED TYPE=\"applicat ion/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.getEle mentById("Video ID")...

    You have solutions

    Thank and regards


  • Thomas 'PointedEars' Lahn

    #2
    Re: Call a video with jscript-function

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

    To make your source code easier legible, use ' as separators for attribute
    strings or use " for the attribute and ' for the JavaScript string separators.
    [color=blue]
    > [...]
    > 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.getEle mentById("Video ID")...[/color]

    I do not see why that is required when document.write( ...) will do the trick.
    [color=blue]
    > You have solutions[/color]

    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

    Comment

    Working...