动态向嵌入式URL添加参数 [英] Dynamically Add Parameters to an Embedded URL

查看:230
本文介绍了动态向嵌入式URL添加参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将程序 jAlbum 与皮肤

I use the program jAlbum with skin Lightflow to build a gallery. I am embedding YouTube videos inside the gallery. The program produces the following HTML (for an individual embedded video) look like this:

<div class="item">
 <img class="content hidden" src="thumbs/video.jpg" alt="" />
    <div class="ref hidden">item27</div>
    <div class="caption"><h3></h3></div>
    <div class="comment hidden"></div>
    <div class="author hidden"></div>
    <div class="params hidden">lightwindow_width=640,lightwindow_height=360</div>
    <div class="info hidden"></div>
    <div class="embed hidden"><iframe width="640" height="360" 
src="http://www.youtube.com/embed/E-lTPK5sQAA?fs=1&feature=oembed" 
frameborder="0" allowfullscreen></iframe></div>
    <div class="thumbWidth hidden">350</div>
    <div class="thumbHeight hidden">231</div>
    <a id="item27" class="lightwindow hidden" title="" rel="gal[cat]" 
href="http://www.youtube.com/watch?v=E-lTPK5sQAA" ></a>
    </div>

我想在youtube嵌入代码中添加一些参数.参数是rel=0&modestbranding=1&iv_load_policy=3

I would like to add some parameters to the youtube embed code. The parameters are rel=0&modestbranding=1&iv_load_policy=3

我无法将它们添加到图库中(或者至少我不知道如何添加),因此在将页面加载到浏览器中之后,我需要将它们动态添加到YouTube src代码的末尾.

I cannot add these inside the gallery (or at least I am ignorant of how) so I need to add these dynamically to the end of the YouTube src code after the page is loaded in the browser.

我该怎么做?请提供示例,因为Javascript可能会使我陷入困境.

How do I go about doing this? Please provide examples as Javascript can throw me for a loop.

编辑1

EDIT 1

我尝试了以下代码:

var $j = jQuery.noConflict();
$j('iframe').attr('src', $j(this).attr('src') + 
  '&rel=0&modestbranding=1&iv_load_policy=3'));

并且当我在Dreamweaver中引发语法错误并且Firebug说我是missing ; before statement代码中我缺少什么?

and when I syntax errors are thrown in dreamweaver and Firebug says I am missing ; before statement What am I missing in the code?

编辑2

EDIT 2

当我尝试上面的代码时,src更改为undefined&rel=0&modestbranding=1&iv_load_policy=3

When I try the above code the src is changed to undefined&rel=0&modestbranding=1&iv_load_policy=3

推荐答案

看到注意:您必须使用jQuery 1.6+才能支持道具.

Note: You must be using jQuery 1.6+ for prop to work.

这篇关于动态向嵌入式URL添加参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆