在iframe和父类之间传递jQueryvariables
我如何使用jQuery和iframe 。 获取并传递从iframe到body和从body到iframe var 。 我有下面的例子。 我怎样才能点击iframe的button,并使其在#test body #test 。 如何在iframe中准备好var x。 
 <body> var x = "whatever"; <div id"test"></div> <iframe width="200px" height="200px" src="page.html"></iframe> </body> 
里面page.html我有
 <button>clickme</button> <script> var elm = $('<span>content</span>'); elm.appendTo('#test') </script> 
	
 $("#myid", top.document); 
要么
 $("#myid", parent.document.body); 
这将使您可以访问IFRAME的容器
按照: http : //groups.google.com/group/jquery-en/browse_thread/thread/5997ef4a60a123af
从父母的angular度来看:
 var iFrameValue = $('#iframe').get(0).contentWindow.myLocalFunction(); 
要么
 var iFrameValue = $('#iframe').get(0).contentWindow.myLocalVariable; 
从iframe的angular度来看
 <script type="text/javascript"> var myLocalVariable = "hello"; function myLocalFunction () { return "hello"; } </script> 
 您可以使用contentWindow和contentDocument属性,如果相同的来源poilicy不是一个问题。 我已经设置了一个演示 。 查看演示 代码和iframe代码 。