frankx: getElement in IFRAME will nicht !?

Beitrag lesen

  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  
"http://www.w3.org/TR/html4/loose.dtd">  
<html>  
 <head>  
  <title>Iframe Container</title>  
  <script>  
  iframefunktion=function() {  
   //document.getElementsById(  
   alert(window.frames["my_iframe"].document.getElementsByTagName('body')[0].style.backgroundColor);  
   window.frames["my_iframe"].document.getElementsByTagName('body')[0].style.backgroundColor="blue";  
  }  
  </script>  
 </head>  
 <body>  
 <button onclick="iframefunktion()">iframefunktion()</button>  
 <iframe src="iframe_content.html" name="my_iframe"/>  
 <div id="info">Infodiv</div>  
  
 </body>  
</html>  

iframe_content.html=

  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  
"http://www.w3.org/TR/html4/loose.dtd">  
<html>  
 <head>  
  <title>Iframe</title>  
  
 </head>  
 <body style="background-color:red" id="body">  
  <h1>Ich bin der IFrame</h1>  
 </body>  
</html>