Using JS to operate IFRAME in a FRAME and its implementation code _ javascript skills

Source: Internet
Author: User
This kind of thing is always needed. If you find this good thing, you must study it: in the address bar, enter a piece of JS to set the iframe url and TEXT value in a FRAME on the page, and then click Submit. Note: The page is from other websites. Do not give answers to some Page code changes. The details are as follows:

Main Page .htm:

View plaincopy to clipboardprint?


Main. jsp:





Requirements:

1. After the home page is opened, enter a piece of JS in the address bar to change the src of mainFrame to http: //.../c. jsp.

2. after the home page is opened, enter a piece of JS in the address bar to set mainFrame. In this case, the value of the text box "txt1" on the page is "119 ", click "btn1.

After GOOGLE, no similar answers were found. So I tried and got the answer. I believe it will be helpful for anyone who asks the same question.

1. javascript: frames ("primaryFrame" 2.16.doc ument. mainFrame. location = http: //.../c. jsp;

2. javascript: var a = frames ("primaryFrame" 2.16.document.mainframe.doc ument. getElementById ("txt1 "). value = "119"; frames ("primaryFrame" 2.16.document.mainframe.doc ument. getElementById ("btn1 "). click ();

Why is the text box var a = frames ("primaryFrame" 2.16.document.mainframe.doc ument. getElementById ("txt1 "). value = "119"; instead of using frames ("primaryFrame" example .document.mainframe.doc ument. getElementById ("txt1 "). value = "119"; you can try it.
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.