如何使用Jquery在iframe中加载网址 [英] How do I load an url in iframe with Jquery
本文介绍了如何使用Jquery在iframe中加载网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在点击时加载iframe,这是我到目前为止所拥有的:
I want to load an iframe on click, this is what I have so far:
$("#frame").click(function () {
$('this').load("http://www.google.com/");
});
它不起作用。这是完整的代码: JS Bin
It doesn't work. This is the complete code: JS Bin
推荐答案
$("#button").click(function () {
$("#frame").attr("src", "http://www.example.com/");
});
HTML:
<div id="mydiv">
<iframe id="frame" src="" width="100%" height="300">
</iframe>
</div>
<button id="button">Load</button>
这篇关于如何使用Jquery在iframe中加载网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文