【发布时间】:2014-10-14 06:43:15
【问题描述】:
您好,我想将一个函数从 1 个 .html 文件调用到另一个 .html 文件
Parent.html
<html>
<body>
<script>
function alertFunction()
{
alert("I am an alert box!");
}
</script>
<iframe src="childFile.html" width="80%" height="80%"></iframe>
</body>
</html>
Child.html
<button type="button" onClick="alertFunction()">button</button>
因此,当我点击父 .html 页面时,将打开一个带有该框架中按钮的框架......当我单击该按钮时,它应该调用该函数并在 parent.html 文件中显示警报
【问题讨论】:
-
你应该编写单独的 javascript 文件
标签: javascript html iframe