Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/398.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用javascript修改基于iframe的htmldom_Javascript_Html - Fatal编程技术网

使用javascript修改基于iframe的htmldom

使用javascript修改基于iframe的htmldom,javascript,html,Javascript,Html,index.html <html> <head> <title>Index</title> </head> <body> <p>some text</p> <a href="https://..." target="f">link</a> <iframe name="f"></iframe> </body> </html> 指

index.html

<html>
<head>
<title>Index</title>
</head>
<body>
<p>some text</p>
<a href="https://..." target="f">link</a>
<iframe name="f"></iframe>
</body>
</html>

指数
一些文本

一旦目标网站在iframe中完全加载,是否可以将文本隐藏在p-tag中?

尝试此方法以获得解决方案

根据@Barmar注释修改链接

HTML


可能的副本我建议你也考虑使用。它将极大地帮助您,不再需要了解DOM中的所有低级JavaScript函数。非常感谢。@Akshay在回复中发布它。你为什么把JS放在codepen的HTML框中?
<p id="removeText"> some text</p>
<iframe src="demo_iframe.htm" name="iframe_a" id="iframe_a"></iframe>
<a href="https://www.w3schools.com" target="iframe_a">W3Schools.com</a>
document.getElementById('iframe_a').onload = function() {
   document.getElementById('removeText').innerHTML = '';
}