therealwesfoster Posted December 6, 2007 Share Posted December 6, 2007 ifrm = document.createElement("IFRAME"); ... ... ... This works: document.body.appendChild(ifrm); This doesnt: document.getElementsByTagName('font')[10].appendChild(ifrm); I get no errors, but when I view the source, it hasn't appended to the html anywhere. ??? I'm needing it to append the IFRAME inside of the font tags instead of the body (because of an IE error).. but it's not working.. help please Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted December 6, 2007 Share Posted December 6, 2007 That is not going to change your source code. Display your full code; so I can have a better view of what your trying to do. Quote Link to comment Share on other sites More sharing options...
therealwesfoster Posted December 6, 2007 Author Share Posted December 6, 2007 The entire file is pretty long so here is the jist <html> <head> <title>title</title> </head> <body> <table align="center"> <tr> <td colspan="2"> <table align="center"> <tr> <td>header stuff</td> </tr> </table><br/> </td> </tr> <tr> <td> <table align="center"> <tr> <td>left area text and images</td> <td>...<font class="iframe_info"><script src="javascript.js"></script></font></td> </tr> </table> </td> </tr> </table> </body> </html> See, I can't use document.body.appendChild() between the font tags because of this ( http://support.microsoft.com/default.aspx/kb/927917 ).. so i must either move the script's calling, OR, do something like document.getElementsByTagName('font')[10].appendChild(ifrm); I hope that helps a little bit more Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted December 6, 2007 Share Posted December 6, 2007 Didn't we solve this sample type of question a couple of days ago? I am not trying to come off smart with this question; but I think you could do this similar to this thread: http://www.phpfreaks.com/forums/index.php/topic,170732.msg755024.html#msg755024 I like to try to find the easiest way to do things. Quote Link to comment Share on other sites More sharing options...
therealwesfoster Posted December 6, 2007 Author Share Posted December 6, 2007 That was something different... I'm appending a element i created with javascript, not something I've written out and just need to insert into the innerHTML Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted December 6, 2007 Share Posted December 6, 2007 have you added all the other iframe properties (ie width,height,src, and so on.....)? Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted December 6, 2007 Share Posted December 6, 2007 here you go: <html> <head> <title>title</title> <script language="javascript"> function insertFrame() { ifrm = document.createElement("IFRAME"); ifrm.setAttribute("src", "http://google.com/"); ifrm.setAttribute("frameborder", "0"); ifrm.setAttribute("name", "gf"); ifrm.style.width = 300+"px"; ifrm.style.height = 300+"px"; document.getElementsByTagName('font')[0].appendChild(ifrm); } </script> </head> <body onload="insertFrame()"> <table align="center"> <tr> <td colspan="2"> <table align="center"> <tr> <td>header stuff</td> </tr> </table><br/> </td> </tr> <tr> <td> <table align="center"> <tr> <td>left area text and images</td> <td>...<font class="iframe_info"></font></td> </tr> </table> </td> </tr> </table> </body> </html> I had to go back to you previous code. See how this code turns out for you. Quote Link to comment Share on other sites More sharing options...
therealwesfoster Posted December 6, 2007 Author Share Posted December 6, 2007 well, i didn't want to do it like that but i guess thats all i can do.. thanks Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted December 6, 2007 Share Posted December 6, 2007 I think your going to have to call the appendChild some way or the other with a function; I think that is the only way you can do this - maybe because of a browser security feature. I'm not 100% about this; but if you can find a better way and make it function like you want it to - then by all means do it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.