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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Nov 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Simple JS function call not working in IE or Chrome. Works in Firefox!

    This simple code is working fine in Firefox but not IE or Chrome. Can you please help me?

    <object width="533" height="300">
    <param name="movie" value="http://www.youtube.com/v/2wBe3SDCcz8"></param>
    <param name="wmode" value="transparent"></param>
    <embed src="http://www.youtube.com/v/2wBe3SDCcz8" type="application/x-shockwave-flash" wmode="transparent"
    width="533" height="300" id="myvideo">
    </embed>
    </object>
    <script>
    function videoplaying() {
    var myvideo = "http://embed.break.com/MjM4NTM2Ng==";
    var myEmbed = document.getElementById("myvideo");
    myEmbed.setAttribute("src", myvideo);
    return false;
    }
    </script>
    <a href="javascript:void(0)" onclick="videoplaying();">Video</a>

  • #2
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,983
    Thanks
    56
    Thanked 557 Times in 554 Posts
    the simplest way seems to be to use an iframe, same as youtube does:
    Code:
    <body>
    <iframe id="myvideo" width="533" height="300" src="" frameborder="0"></iframe>
    <script>
    function videoplaying() {
    document.getElementById("myvideo").src="http://embed.break.com/MjM4NTM2Ng==";
    return false;
    }
    </script>
    <a href="#" onclick="videoplaying();">Video</a>
    </body>

  • Users who have thanked xelawho for this post:

    ttkh2011 (11-07-2012)

  • #3
    New to the CF scene
    Join Date
    Nov 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts
    xelawho,

    Thank you so much for your help. This is not ideal but it does the job for me temporary.


  •  

    Posting Permissions

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