从变量获取jquery链接并传递给iframe src

时间:2014-11-09 16:57:56

标签: jquery html iframe

我是jQuery的新手,我有一个问题。我正在开发一个themewitcher模板。基本上,它的作用是:用户点击模板的名称,然后在iframe中加载模板。 演示站点的链接是这一个:http://demo.pingusol.com。问题是当我点击模板的名称时没有显示。 html中的iframe链接就是这个:

<iframe id="templateframe" class="templateframecontainer" name="templateframe" src=<?     $_GET['template']?>  style="width: 100%; height: 535px;"></iframe>

http://demo.hotjoomlatemplates.com找到了我想要实现的模型 任何帮助都是相关的。 谢谢。

编辑:更新了代码,现在可以使用了。但是,如果我想在第一页显示活动模板? iframe代码如下所示:<iframe id="templateframe" class="changeIframe" name="templateframe" src="<? echo $_GET['template']?>" style="width: 100%; height: 535px;"></iframe>

1 个答案:

答案 0 :(得分:0)

$("a.changeIframe").click(function(e){ e.preventDefault(); var link=$(this).attr('href'); $("#templateframe").src(link); }

将类changeIframe添加到要更改iframe src的链接

你错过了什么 src=<?= $_GET['template']?> 它没有回音,但是对于你的欲望行为,这个

src=<?= (isset($_GET['template']) and $_GET['template']!='')?$_GET['template']:'default_page.php'?>
相关问题