Home  >  Article  >  Web Front-end  >  Operation of iframe in jQuery (click the button to create a new window)_jquery

Operation of iframe in jQuery (click the button to create a new window)_jquery

WBOY
WBOYOriginal
2016-05-16 15:04:271417browse

d5ba1642137c3f32f4f4493ae923989c should also be a form of frame. The difference from 04a0d55efbbfd646a993fbc01f262c57 is that iframe can be embedded in any part of the web page.

I encountered a problem today: How to click a button to add a new small window to the current page to display a picture information?

As shown below:

Before clicking:

After clicking:

Analysis: To prevent the newly added small window from affecting the parent page, we use the iframe framework technology here.

[d5ba1642137c3f32f4f4493ae923989c should also be a form of frame. The difference from 04a0d55efbbfd646a993fbc01f262c57 is that iframe can be embedded in any part of the web page. 】

The implementation idea is: (1) Add a click event to the button, add an iframe window after the click, and add the address of the generated image.

Specific implementation code:

(1) Add a click event to the button:

<input type="radio" name="dynamicType" id="dianji" style="padding: 0 10px 0 5px;margin-left:10px;margin-top: 13px;"/>
<p class="loadPhoto"></p>
$("#dianji").click(function(){
  $("p.loadPhoto").empty(); // 清空原来的p标签的中内容
  $("p.loadPhoto").html("<iframe width=520 height=400 name=\"touzizuhe\" id=\"touzizuhe\" frameborder=0 src="生成图片的地址"></iframe>");// 添加iframe的jquery的语句
});

Note: After the development of the iframe here, the address where the image is generated will be automatically accessed, so that the need for image generation is met.

This is all about the operation of iframe in jQuery (click the button to create a new window). I hope it will be helpful to you!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn