Q: I want to input a piece of JS in the address bar 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?
<FRAMESET border = 0 frameSpacing = 0 frameBorder = 0 cols = *, 1005, *> <FRAME src = "blank.html" frameBorder = 0 noResize scrolling = no> <FRAMESET border = 0 frameSpacing = 0 rows = *, 585, * frameBorder = 0> <FRAME name = Frame1 src = "http ://... /blank.html "frameBorder = 0 noResize scrolling = no> <FRAME name = primaryFrame src =" http ://... /main. jsp "frameBorder = 0 noResize scrolling = no> <FRAME src =" http ://... /blank.html "frameBorder = 0 noResize scrolling = no> </FRAMESET> <FRAME src =" http ://... /blank.html "frameBorder = 0 noResize scrolling = no> </FRAMESET>
<FRAMESET border = 0 frameSpacing = 0 frameBorder = 0 cols = *, 1005, *> <FRAME src = "blank.html" frameBorder = 0 noResize scrolling = no> <FRAMESET border = 0 frameSpacing = 0 rows = *, 585, * frameBorder = 0> <FRAME name = Frame1 src = "http ://... /blank.html "frameBorder = 0 noResize scrolling = no> <FRAME name = primaryFrame src =" http ://... /main. jsp "frameBorder = 0 noResize scrolling = no> <FRAME src =" http ://... /blank.html "frameBorder = 0 noResize scrolling = no> </FRAMESET> <FRAME src =" http ://... /blank.html "frameBorder = 0 noResize scrolling = no> </FRAMESET> main. jsp:
<Iframe id = chatFrame name = chatFrame src = "http: //.../a. jsp"> </iframe>
<Iframe id = mainFrame name = mainFrame src = "http: //.../B. jsp"> </iframe>
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.