我想在我的页面中显示YouTube视频。
http://www.youtube.com/v/u1zgFlCw8Aw?fs=1
上面是它的网址。
我写了embed标签,但无法正确完成。
我可以嵌入标签或其他任何方式在我的网站上使用其网址显示管视频吗?
答案 0 :(得分:0)
如下所示:Embedding a Youtube video
.aspx 页中的
<asp:Label ID="LabelShowYouTubeVideo" runat="server"></asp:Label>
.aspx.cs 代码隐藏文件中的:
// this is the YouTube Video ID, here you replace by
// the code of the one you want to show
string VideoID = "nQJACVmankY";
// Here this code you show in the label the YouTube Video that you put the code
LabelShowYouTubeVideo.Text = "<object width='425' height='355'><param name='movie' value='http://www.youtube.com/v/" + VideoID + "'></param><param name='wmode' value='transparent'></param><embed src='http://www.youtube.com/v/" + VideoID + "' type='application/x-shockwave-flash' wmode='transparent' width='425' height='355'></embed></object>";
修改:添加部分:观看?根据需要到网址。我复制了我在ASP.NET论坛中发现的并没有自己运行它,但人们回答说它完美无缺!