IFrame事件在HTML中执行正常,但不在HTA中执行 [英] IFrame event executes fine in HTML but not in HTA
本文介绍了IFrame事件在HTML中执行正常,但不在HTA中执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<!DOCTYPE html PUBLIC - //此HTML文件显示消息对话框W3C // DTD HTML 4.01 Transitional // EN>
< html>
< head>
< script language =VBScripttype =text / vbscript>
Sub load_me()
frame.document.write< input type ='button'onclick ='parent.message()'>
End Sub
Sub message()
MsgBoxHi
End Sub
< / script>
< / head>
< body>
< iframe id =frameonload =load_me>< / iframe>
< / body>
< / html>
与HTA文件相同的文档引发错误: Error:Object doesn' t支持此属性或方法
:
<!DOCTYPE html PUBLIC - // W3C / / DTD HTML 4.01 Transitional // EN>
< html>
< head>
< title>测试< /标题>
< HTA:APPLICATION
APPLICATIONNAME =Test
ID =MyHTMLapplication
VERSION =1.0/>
< script language =VBScript>
Sub load_me()
frame.document.write< input type ='button'onclick ='parent.message()'>
End Sub
Sub message()
MsgBoxHi
End Sub
< / script>
< / head>
< body bgcolor =white>
< iframe id =frameonload =load_me>< / iframe>
< / body>
< / html>
为什么会这样,或者我如何用 onclick code>从HTA中的iframe按钮发生的事件
解决方案
使用:
< iframe id =frameonload =load_meapplication =yes>< / iframe>
请参阅 .HTA介绍,信任的力量:HTA和安全性
This HTML file shows message dialog when button inside iframe is clicked:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script language="VBScript" type="text/vbscript">
Sub load_me()
frame.document.write "<input type='button' onclick='parent.message()'>"
End Sub
Sub message()
MsgBox "Hi"
End Sub
</script>
</head>
<body>
<iframe id="frame" onload="load_me"></iframe>
</body>
</html>
While same document as HTA file, raises error: Error: Object doesn't support this property or method
:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
<HTA:APPLICATION
APPLICATIONNAME="Test"
ID="MyHTMLapplication"
VERSION="1.0"/>
<script language="VBScript">
Sub load_me()
frame.document.write "<input type='button' onclick='parent.message()'>"
End Sub
Sub message()
MsgBox "Hi"
End Sub
</script>
</head>
<body bgcolor="white">
<iframe id="frame" onload="load_me"></iframe>
</body>
</html>
Why is that, or how can I execute parent function with onclick
event from iframe button in HTA?
解决方案
Use:
<iframe id="frame" onload="load_me" application="yes"></iframe>
See Intro to .HTA, section The Power of Trust: HTAs and Security
这篇关于IFrame事件在HTML中执行正常,但不在HTA中执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文