Código:
Eso no funciona, pero si hago un:<script> var win; win = window.open('', 'POPUP' , 'resizable=no, scrollbars=no, status=yes'); var x = 425; var y = 390; win.resizeTo(x, y); win.moveTo((screen.width - x)/2, (screen.height - y)/2); win.document.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"); win.document.write("<html>"); win.document.write("<head>"); win.document.write("<meta content=\"text/html; charset=iso-8859-1\" http-equiv=\"content-type\">"); win.document.write("<title>Insertar imagen</title>"); win.document.write("</head>"); win.document.write("<body topmargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\" marginheight=\"0\" marginwidth=\"0\""); win.document.write("<iframe id=\"p\" src=\"x.html\" onload=\"show();\"></iframe>"); win.document.write("<script>"); win.document.write("function show() {"); win.document.write(" alert(document.getElementById('p').contentWindow.document.body.innerHTML);"); win.document.write(" return false;"); win.document.write("}"); win.document.write("<\/script>"); win.document.write("</body>"); win.document.write("</html>"); win.document.close(); </script>
Código:
Funciona perfectamente .... alguien sabe por que?¿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> <iframe id="p" src="x.html" onload="show();"></iframe> <script> function show() { alert(document.getElementById('p').contentWindow.document.body.innerHTML); return false; } </script> </body> </html>
Y por que tambien si una etiqueta como <body></body> ... no te da error por uqe si lo da <script></script>?
Muchas gracias!!