<textarea id="runcode1221"><! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <pead> <title>iframe Learning </title> <script Type= "Text/javascript" > Function changesrc () {var i1 = document.getElementById ("iframe1"); I1.SRC = "http://www.kanshule.com"; function GetText () {//var x = document.getElementById ("iframe1"). contentdocument;//This method does not pass var x = window.frames["iframe 1 "].document.body.innerhtml; var y = window.frames["iframe1"].document.getelementbyid ("T1"). Value; Alert (x+ "\ n" +y); } </script> </pead> <body> <iframe src= "http://www.jb51.net" id= "iframe1" ></iframe> ; Input type= "button" value= "Change src" onclick= "changesrc ();"/> <input type= "button" value= "GetText" onclick= " GetText (); "/> </body> </ptml></textarea>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]