I haven't written an article for a long time. I feel that the writing is too unfamiliar. I hope you don't laugh.
We can use the jquery. impromptu plug-in to simplify a lot of work when making a pop-up form. We only need to add a little bit to implement powerful functions.
Jquery. impromptu: http://trentrichardson.com/Impromptu/index.php
:
Method 1:
Create an ifame container page: framecontainer. aspx
Code for this page:
1 <% @ page Language = "C #" autoeventwireup = "true" %>
2 <SCRIPT runat = "server">
3
4 protected string framename;
5
6 protected void page_load (Object sender, eventargs E)
7 {
8 framename = request ["framename"]? "";
9}
10 </SCRIPT>
11 <IFRAME id = "iframe" src = '<% = framename %> 'width = "100%" scrolling = "no" frameborder = "0" onLoad = "this.height1_iframe.doc ument. body. scrollheight; "> </iframe>
Add code to the jquery. impromptu file:
1 function getframe (framename)
2 {
3 $. Get (
4 "framecontainer. aspx? Framename = "+ framename,
5 function (date ){
6 $. Prompt (date ,{
7 buttons :{}
8 });
9}
10 );
11}
Call times code
<Input type = "button" value = "normal" onclick = "getframe ('default. aspx ');"/>
When you click the button, the 'default. aspx 'is loaded in IFRAME'
Don't forget to reference jquery and jquery. impromptu
Method 2:
This method does not require the container page to carry IFRAME. Add the Code directly in jquery. impromptu:
1 function getframe (framename ){
2 $. prompt ("<IFRAME id = 'iframe' src = '" + framename + "'width = '000000' scrolling = 'no' frameborder = '0' onload='this.height=iframe.doc ument. body. scrollheight '> </iframe> ",{
3 buttons :{}
4}); // onloadpolic'this.height?iframe.doc ument. Body. scrollheight' ensures the IFRAME height and the page to be loaded
5
6 };
The same call Method
<Input type = "button" value = "normal" onclick = "getframe ('default. aspx ');"/>
Don't forget to reference jquery and jquery. impromptu
Finally, we may need to close the bullet box in the pop-up IFRAME. We need to write this as follows:
Registry.parent.document.body.removechild(registry.parent.doc ument. getelementbyid ("jqibox "));
Jqibox is the jquery. impromptu pop-up container