使用javascript修改基于iframe的htmldom
index.html使用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> 指
<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 = '';
}