No need to modify the original page to implement pop-up IFRAME

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.