100分+100元RMB求助?

asq985 asq985 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
a.html
<html>
<head>
<script>
alert("a");
</script>
</head>

<body>
<iframe id="b1" src="b.html"> </iframe>
</body>
</html>

b.html
<html>
<head>
<script>
alert("b");
</script>
</head>

<body>
<a href="javascript:;" onclick="alert('link');">link </a>
<iframe id="c1" src="c.html"> </iframe>
</body>
</html>

c.html
<html>
<head>
<script>
alert("c");
</script>
</head>
</html>

用vs2008 webbrowser控件:


Dim a1 As IHTMLDocument2 = Webbrowser1.Document.Window.Document.DomDocument
a1.parentWindow.execScript("function alert(str){}", "javascript")

Dim a2 As IHTMLDocument2 = Webbrowser1.Document.Window.Frames(0).Document.DomDocument
a2.parentWindow.execScript("function alert(str){}", "javascript")

Dim a3 As IHTMLDocument2 = Webbrowser1.Document.Window.Frames(0).Frames(0).Document.DomDocument
a3.parentWindow.execScript("function alert(str){}", "javascript")





为什么a2没起到作用呢?也就是不能把b.html中的alert屏蔽,但如果点击b.html中的link应该有一个alert弹出,但没有,也就是说屏蔽掉了,但是没屏蔽掉alert('b')
首先感谢!!!
...全文
评论 11
收藏 已收藏
分享
返回顶部
asq985
VB 16,718 成员 110,520 内容