Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Apr 2006
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Two embedded WMV on one page ?

    Hi,

    This is probably quite simple, but it's beyond my simple brain to figure it out, so please be gentle with me.

    We have a page, with regular html content and TWO embedded videos. The code for the videos are as follows:
    Code:
    <script type="text/javascript">function f1154632629343(obj) {obj.parentNode.innerHTML = '<embed src="http://domain.com/zbluescalendar.wmv" width="288" height="259" autostart="1" showcontrols="1" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/windowsmedia/download/"> </embed>';}</script><div><img src="http://domain.com/zbluescalendar.jpg" height="216" width="288" alt="" style="cursor:pointer;" onclick="f1154632629343(this)">
    
    <script type="text/javascript">function f1154632629343(obj) {obj.parentNode.innerHTML = '<embed src="http://http://domain.com/zmalaysiancookingcalendar.wmv" width="288" height="259" autostart="1" showcontrols="1" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/windowsmedia/download/"> </embed>';}</script><div><img src="http://domain.com/zasiancookingcalendar.jpg" height="216" width="288" alt="" style="cursor:pointer;" onclick="f1154632629343(this)">
    The problem is that whereas both thumbnails show on the page, both thumbnails play the same video.

    Please help. Thanks.

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Yes because both functions have the same name. I believe the function declared last is what is used. You need to pass the url of the video to the function like so.
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitled Document</title>
    <script type="text/javascript">
    function playVid(obj,url)
    {
    	obj.parentNode.innerHTML = '<embed src="'+url+'" width="288" height="259" ' 
    	+'autostart="1" showcontrols="1" type="application/x-mplayer2" '
    	+'pluginspage="http://www.microsoft.com/windows/windowsmedia/download/"> </embed>';
    }
    </script>
    </head>
    
    <body>
    <div><img src="http://domain.com/zbluescalendar.jpg" height="216" width="288" alt="" style="cursor:pointer;" onclick="playVid(this,'http://domain.com/zbluescalendar.wmv')">
    <div><img src="http://domain.com/zasiancookingcalendar.jpg" height="216" width="288" alt="" style="cursor:pointer;" onClick="playVid(this,'http://domain.com/zmalaysiancookingcalendar.wmv')"></div>
    </body>
    </html>
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Registered User
    Join Date
    Apr 2006
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by _Aerospace_Eng_ View Post
    Yes because both functions have the same name. I believe the function declared last is what is used. You need to pass the url of the video to the function like so.
    Hello _Aerospace_Eng_,

    I remember, you came to my rescue before Thank you so much. I really appreciate it.

  • #4
    Registered User
    Join Date
    Apr 2006
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Just one question though.

    Is it possible to use/integrate the javascript in the body with the video link rather than in the header?

    The reason I ask is because sometimes the videos are different sizes, and this would also allow us to use the same code in a PHP calendar script we have, where it is impractical to edit stuff in the header.

    Thanks very much.

  • #5
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    It doesn't matter where the script goes as long as its on the page either in between the head tags or the body tags. If you actually tried it else where you would have answered your own question.

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitled Document</title>
    </head>
    
    <body>
    <script type="text/javascript">
    function playVid(obj,url,wid,hgt)
    {
    	obj.parentNode.innerHTML = '<embed src="'+url+'" width="'+wid+'" height="'+hgt+'" ' 
    	+'autostart="1" showcontrols="1" type="application/x-mplayer2" '
    	+'pluginspage="http://www.microsoft.com/windows/windowsmedia/download/"> </embed>';
    }
    </script>
    <div><img src="http://domain.com/zbluescalendar.jpg" height="216" width="288" alt="" style="cursor:pointer;" onclick="playVid(this,'http://domain.com/zbluescalendar.wmv','288','259')">
    <div><img src="http://domain.com/zasiancookingcalendar.jpg" height="216" width="288" alt="" style="cursor:pointer;" onClick="playVid(this,'http://domain.com/zmalaysiancookingcalendar.wmv','288','259')"></div>
    </body>
    </html>
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #6
    Registered User
    Join Date
    Apr 2006
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you very much.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •