【发布时间】:2010-08-31 09:09:59
【问题描述】:
我有一个视频列表 - 每个视频都有一个 onlick 函数 - onlick 函数应该替换 :
<object width="640" height="385">
<param name="movie" value="http://www.youtube.com/v/QmOkhayXlYw?fs=1&hl=da_DK"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/v/QmOkhayXlYw?fs=1&hl=da_DK" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed>
</object>
因此,当点击列表中的视频时,value 和 src 中的 URL 应替换为来自 onlick 函数的新 URL:
<xsl:variable name="XMLvideoID">
<xsl:value-of select="id"/>
</xsl:variable>
<xsl:variable name="videoId">
<xsl:value-of select="substring-after('$XMLvideoID','videos/')"/>
</xsl:variable>
<div class="video" onclick="playYouTubeVideo(http://www.youtube.com/v/{$videoId}?fs=1)">
<div class="thumb">
<img src="http://i.ytimg.com/vi/{$videoId}/2.jpg" height="90" width="120" alt="" title="" border="" />
</div>
<div class="info">
<div class="title">
<xsl:value-of select="title" disable-output-escaping="yes"/>
</div>
</div>
</div>
【问题讨论】:
标签: javascript jquery youtube