I am tryin to embed youtube in my webpage. I am a starter so i might be doing something wrong here. can any please help me on this. I have included the swobject.

<html>
   <script type="text/javascript" src="swfobject.js"></script>      
   <div id="ytapiplayer">
      You need Flash player 8+ and JavaScript enabled to view this video.
   </div>
   <script type="text/javascript">
      var params = { allowScriptAccess: "always" };
      var atts = { id: "myytplayer" };
      swfobject.embedSWF("http://www.youtube.com/v/VIDEO_ID?enablejsapi=1&playerapiid=ytplayer", 
                                 "ytapiplayer", "425", "356", "8", null, null, params, atts);
   </script>
   <script type="text/javascript">
   function onYouTubePlayerReady(playerId) {
         ytplayer = document.getElementById("myytplayer");
      }
   </script>
   <a href="javascript:void(0);" onclick="onYouTubePlayerReady();">Play</a>
   </html>

Recommended Answers

All 2 Replies

somilbansal, you have posted this in the wrong forum.

Please re-post this in the appropriate forum under javascript. which can be found here

Thread closed as there is double in JS section.

@tyson.crouch rather then requesting user to repost his question use "Flag Bad Post" option to notify moderators that post is in wrong section and assigned moderator will move it to right place

somilbansal, you have posted this in the wrong forum.

Please re-post this in the appropriate forum under javascript. which can be found here

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.