【发布时间】:2023-03-13 03:10:01
【问题描述】:
我将创建一个 Iframe,它必须动态更新其内容(通过 src 属性 - 每次单击不同按钮时,Iframe 都会更改其位置)以播放我公司创建的不同 youtube 视频。问题是我看到你可以使用 jquery 来实现这一点。我现在对jquery一无所知,但需要时间来学习它。现在,我需要一个答案。如何使用 Jquery(或任何替代的浏览器友好方法)来更改我的 iframe 的 src 属性?
<script runat="server">
</script>
<div style="margin-left:auto;margin-right:auto">
<table style="width: 960px" cellpadding="0px" cellspacing="0px">
<tr>
<td rowspan="6">
<iframe title="YouTube video player" width="480" height="390" src="http://www.youtube.com/embed/JZOxqVl5oP4"
frameborder="0" allowfullscreen id="VideoPlayer"></iframe>
</td>
<td style="Width: 130px">
<img width="130px" src="./Images/Video_Logos/l_absa.gif" />
</td>
...
请注意,有 10 个按钮。按钮是图像,我打算为不同的视频调用不同的“方法”来播放。
我知道 javascript 的 Document.GetElementById("VideoPlayer").SetAttribute("src","NEW LOCATION") 在一个函数中,但是,让我们面对现实吧。 IE6 + 7 很烂。
【问题讨论】:
-
简答:不要使用 iframe =)
-
因为如果有c#的答案,我也能看懂:)虽然我还是个学生
标签: c# javascript jquery asp.net