Correct writing of scripts when accessing Easyui JSP pages in IFRAME

Source: Internet
Author: User

A lot of beginners easyui people will encounter such a problem, that is, in the page with the IFRAME tag, when the direct designated SRC page is a Easyui component of the page, when the parent window needs to access the object in the IFRAME, should not use document access , you should access the object of the IFRAME so that you can access the object's properties and methods using the standard APIs in Easyui, which are accessed in two ways:

1, document.getElementById (' Ss_frame '). contentwindow.$ (' #dgMANUF '). DataGrid (' getselected ');

2, $.find (' iframe ') [0].contentwindow.$ (' #dgMANUF '). DataGrid (' getselected ');

Do not use $ (' #ss_frame '). contentwindow.$ (' #dgMANUF '). DataGrid (' getselected '); Such code, because the object cannot be returned correctly in jquery, the system prompts "Cannot get Properties" NodeName "Value: object is null or undefined error".

The problem of accessing an object solves another problem. iframe refresh problem, because we may be using dynamic pages, we see many solutions that as long as the object's SRC modification can be correctly displayed, but we found that the system has a delay, and this is a fatal error for the Scripting client. The solution is actually very simple, that is, directly to the object of the IFRAME output a hint, until the page load completed. The specific resolution code is as follows:

document.getElementById (' Ss_frame '). ContentWindow.document.write (' Loading ... ');

Related Article

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.