我也想知道,找了半天只找到一篇 iframe 的。
我打算实在不行就用 iframe 凑合了。
楼主也看看 You can also pass data to and from an <iframe> 
Firstly, set up your iframes with a name: 
Code: <iframe src="about:blank" name="iframe1"></iframe> 
<iframe src="about:blank" name="iframe2"></iframe> 
 
In the main page you simply use the iframe name to call the function, variable or object you want. From an iframe, you can call functions variables and objects in the main page OR another iframe. This is how you could do all of these things in one example... save this as 'iframeexample.html' Code: 
<html> <head> 
<title>iframe example 1.0</title> 
<script LANGUAGE="JavaScript" type="text/javascript"> 
var wot; function anothertest(){ 
alert("This alert is from the parent."); 
} </script> 
</head> <body> 
<p>Save this bit as 'iframeexample.html'</p> <p><a href="#" onClick="iframe1.location.href='http://www.odford.co.uk';">Change the location of IFRAME 1</a></p> 
<p><a href="#" onClick="iframe2.test();">Launch a function in IFRAME 2</a></p> <p> 
<iframe src="about:blank" name="iframe1" width="600" height="400"></iframe> 
</p> <p> 
<iframe src="pagetwo.html" name="iframe2" width="400" height="200"></iframe> 
</p> </body> </html> save this as 'pagetwo.html' Code: 
<html> <head> 
<title>iframe example 1.0 - Page Two</title> 
</head> <body> 
<p>Save this bit as 'pagetwo.html' in the same folder</p> <p id="one"><a href="#" onClick="parent.iframe1.location.href='http://www.northernline.net';">Change the location of IFRAME 1 from IFRAME 2 via the 'parent' window.</a></p> 
<p id="two"><a href="#" onClick="parent.anothertest();">Launch a function in 'Parent'</a></p> 
<script LANGUAGE="JavaScript" type="text/javascript"> 
function test() { 
alert('THIS ALERT HAS COME FROM IFRAME 2 - PAGE TWO'); 

</script> 
</body> </html>