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.
[
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!