Javascript 如何与<;车身>;来自iFrame的标记

Javascript 如何与<;车身>;来自iFrame的标记,javascript,dom,iframe,browser,Javascript,Dom,Iframe,Browser,假设我有这样一个代码: <html> <head> </head> <body> <iframe> <script> //execute javascript here to append another piece of javascript in parent body tag </script> </iframe>

假设我有这样一个代码:

<html>
   <head>
   </head>
 <body>
      <iframe>
          <script>
   //execute javascript here to append another piece of javascript in parent body tag
          </script>
      </iframe>
 </body>
</html>

//在此处执行javascript以在父体标记中附加另一段javascript

现在我想在iFrame中执行一些javascript,以便在父body标记中附加另一段javascript。

如果iFrame属于主窗口的同一个域,您只需执行以下操作即可

top.functionToBeCalled(argument);