Using an IFRAME to submit a form, how can I return the value to the previous layer?

Source: Internet
Author: User
1. How do I get the information from the IFRAME to the div?
2. If you use a div without an iframe, how do I make the form in the Div commit and not jump?
3. After the file is submitted to the server, how do I get his address and return to input?

                        

upload.php:

    

Reply content:

1. How do I get the information from the IFRAME to the div?
2. If you use a div without an iframe, how do I make the form in the Div commit and not jump?
3. After the file is submitted to the server, how do I get his address and return to input?

                        

upload.php:

    

upload.phpAfter saving the file, return the path of the file to the upper layer in the form below.


  
   

In simple terms, parent you can then access the content on the page you're on iframe .

Online Demo Address: https://xqin.net/temp/up.html

up.phpThe code is as follows (here is just the demo, so only the current time is output):


  
   上传完成! 
  
   

Before the chrome plug-in, encountered an IFRAME and external communication, do not know if there is any help

Https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage

Https://github.com/xwartz/xwartz.github.com/issues/1

H5web Communication, http://www.cnblogs.com/ATree/archive/2012/03/07/html5-web-messaging.html

After a successful upload in the IFRAME, write the value into the IFRAME.

The event is hung in the window.onload and then goes to the IFRAME and takes data.

The Window object in the IFRAME can not be taken externally, get a function outside, block the default event and then call the external callback when committing in the IFRAME

Submitting a form asynchronously is okay.

  • 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.