如何在click()后在新的iframe中打开网页? [英] How can I open a web page in a new iframe after click()?

查看:99
本文介绍了如何在click()后在新的iframe中打开网页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,您好!

我有一个DOM元素的click()方法,可以更改网页(加载了一些数据但是操作发生在同一页面上,而不是在新标签)。如何强制新数据在同一页面的新框架中表示?



这是伪代码:



Element.click();

 $(document).on( 单击 。classNameOfTheElement,function(){
bla -bla-bla;
LoadPageIntheSameTab(pathOfThePage);
});

解决方案

(document).on ( 点击 。classNameOfTheElement,function(){
bla-bla-bla;
LoadPageIntheSameTab(pathOfThePage);
});


 <   input     type   = 按钮    value   = 点击    onclick   =  return loadPage()     /  >  

< div id = target >
< / div >

< 纸条t type = text / javascript >
function loadPage(){
var el =


('< iframe style = width :500像素;高度:300px; > < / iframe > ');
el.attr(src,http://www.bing.com) ;

Hello, friends!
I have a click() method of a DOM element that makes a webpage be changed (some data are loaded but the action takes place on the same page, not in a new tab). How can I force new data be represented in a new frame on the same page?

Here is the pseudo code:

Element.click();

$(document).on("click", ".classNameOfTheElement", function () {
   bla-bla-bla;
   LoadPageIntheSameTab(pathOfThePage);
    });

解决方案

(document).on("click", ".classNameOfTheElement", function () { bla-bla-bla; LoadPageIntheSameTab(pathOfThePage); });


<input type="button" value="Click" onclick="return loadPage()" />

<div id="target">
</div>

<script type="text/javascript">
    function loadPage() {
        var el =


('<iframe style="width:500px; height: 300px;"></iframe>'); el.attr("src", "http://www.bing.com");


这篇关于如何在click()后在新的iframe中打开网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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