Kolinski Posted July 15, 2013 Share Posted July 15, 2013 I need some help amending a comment tag in a text-area. Of-course this would be easy if I could just simply edit the html. However the script is using an i-frame. I can't find where the i-frame code is. What can I do when looking in the directory for the iframe, where is it? If you need me to show you the file structure that can be done and I can show you the code of where the iframe is. Quote Link to comment Share on other sites More sharing options...
Irate Posted July 15, 2013 Share Posted July 15, 2013 You should be able to modify iframe content with window.frames[index], where index is an integer for each <iframe> element, starting at 0. Example. <html> <head> <title>IFrames</title> <script type="text/javascript"> window.onload = function(){ var ifr = window.frames[0]; for(var i = 0, d; (d = ifr.getElementsByTagName("body")[0].getElementsByTagName("*")[i++]); ){ alert(d.innerHTML); } }; </script> </head> <body> <iframe src="/somepath/somefile.php"> Your browser does not support iframes. </iframe> </body> </html>That would alert the innerHTML of the entire iframe, one by one. Of course, that is not a productive code, but it demonstrates my point. Quote Link to comment Share on other sites More sharing options...
.josh Posted July 15, 2013 Share Posted July 15, 2013 note that if the iframe content is hosted on a (sub) domain other than the parent page, you will not be able to use javascript to access or edit the iframed contents. 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.