i have created on page (index.htm): <html><head><title>TEST</title> <script type="text/javascript"> function hello(){ info.document.open(); info.document.write("Welcome-message"); info.document.close(); } </script></head> <body><iframe src="" name="info"></iframe> <a href="javascript:hello()">link</a> </body></html> what do I write in the scr field, to make to reply to the function hello? I've tryed <iframe src="javascript:hello()" name="info">, but it dosn't work in firefox or iexplorer. (when i use the link, the script works) but when the page loads it dosn't display the "Welcome-message" in the iframebox. Please help! Regards MacWolf
I'm afraid what you are doing isn't allowed. Basically your code is trying to write directly in between the <iframe> tags, which isn't possible. You can test this by creating an iframe such as: <iframe>Some Text Here</iframe> HTML: The "Some Text Here" won't show up when you load the page. This is why your code is failing. Instead, you should update the iframe source. Here is some code I whipped up just for you First you're welcome page (save this as welcome.html): <html> Welcome Message! </html> HTML: And finally your main page, with the DOM scripting and the actual Iframe. <html> <script> function iFrameWrite(id, url){ document.getElementById(id).src = url; } </script> <iframe id="info"></iframe><br /> <a href="#" onclick="javascript:iFrameWrite('info','welcome.html')">Update Iframe</a> </html> HTML: Basically what is happening is when you click the "Update Iframe" link it is making a request to the iFrameWrite() function. You are passing this function the ID of the element you want to update (the iframe) and telling it what page to show in the iframe next. Hope that helps! Feel free to PM me if you have any questions