This article describes the method of javascipt to pass values between two iframes. Share it for your reference, as follows:
index.htm
<body> <table> <tr> <td><iframe src="iframe1.htm" name="aa"></iframe></td> </tr> <tr> <td><iframe src="iframe2.htm" name="bb"></iframe></td> </tr> </table></body>
iframe1.htm
<html><title>1</title><head> <script type="text/JavaScript"> <!-- function aa(){ parent.frames["bb"].document.all["TextBox3"].value = document.getElementById("TextBox1").value; parent.frames["bb"].document.all["TextBox4"].value = document.getElementById("TextBox2").value; alert(parent.frames["bb"].document.all["TextBox3"].value); alert(parent.frames["bb"].document.all["TextBox4"].value); }// --></script></head> <body> <form id="a"> <input id="TextBox1" type="text" id="TextBox1" value="1"/> <input id="TextBox2" type="text" id="TextBox2" value="2"/> <input id="T" type="button" value="3333333" onclick="aa();"/> </form> </body></html>iframe2.htm
<html><title>2</title><head></head> <body> <form id="b"> <input id="TextBox3" type="text" id="TextBox1" value="1231111"/> <input id="TextBox4" type="text" id="TextBox2" value="123"/> </form> </body></html>
For more information about JavaScript related content, please check out the topics of this site: "Summary of JavaScript value transmission operation skills", "Summary of JavaScript encoding operation skills", "Summary of json operation skills in JavaScript", "Summary of JavaScript switching effects and techniques", "Summary of JavaScript search algorithm skills", "Summary of JavaScript animation effects and techniques", "Summary of JavaScript errors and debugging techniques", "Summary of JavaScript data structures and algorithm skills", "Summary of JavaScript traversal algorithms and techniques" and "Summary of JavaScript mathematical operations usage"
I hope this article will be helpful to everyone's JavaScript programming.