Parent page parent.html
<Html><Head><ScriptType= "Text/javascript">functionSay () {alert ("Parent.html"); }functionCallchild () {MyFrame.window.say (); MyFrame.window.document.getElementById ("button"). Value="Call End"; }</Script></Head><Body><Input id= "button"type= "button" value< Span style= "color: #0000ff;" >= "calls the function in child.html say ()" Onclick= "Callchild ()" Span style= "color: #0000ff;" >/> <iframe name = "MyFrame" Src= " child.html "></iframe ></body></html>
Sub-page child.html
<Html><Head><ScriptType= "Text/javascript">functionSay () {alert ("Child.html"); }functionCallparent () {Parent.say (); Parent.window.document.getElementById ("button"). Value="Call End"; }</Script></head><body> << Span style= "color: #800000;" >input id= "button" Type= "button" Value= " Call the Say () function in parent.html " Onclick=" Callparent () "/></body>< Span style= "color: #0000ff;" ></html>
JS gets the file name in the path
var lujing=document.getelementbyid ("content"). Src;
Lujing=lujing.split ("/");
var lujing1=lujing[lujing.length-1];
The main page Gets the child page method of the IFRAME.