Szukam rozwiązania pewnego problemu mianowicie próbuję wyświetlić kod źródłowy strony znajdującej się w IFRAME, udało mi się jedynie odczytać zawartość o zadeklarowanym id. Czy ktoś mógł by pomóc? Pozdrawiam serdecznie
PLIK.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <style> iframe {height:200px; width:300px; border:1px solid #000} </style> <script> function iframeContent() { frame = document.getElementById("myFrame") if (frame.contentDocument) { alert(frame.contentDocument.getElementById("test").innerHTML) } else if (frame.contentWindow) { alert(frame.contentWindow.document.getElementById("test").innerHTML) } } </script> <body> <iframe src="document.html" id="myFrame"> </iframe><br> <button onclick="iframeContent()">OK</button> </body> </html>
IFRAME
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> <p id="test">Text</p> </body> </html>