我给你做了个小例子,运行main.htm就可以了,点击b.htm中的按钮,就可执行a.htm中的myform()函数
---main.htm----
<html>
<head>
<title>小例子</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<frameset cols="80,*" frameborder="NO" border="0" framespacing="0">
<frame name="leftFrame" scrolling="NO" noresize src="b.htm">
<frame name="mainFrame" src="a.htm">
</frameset>
<noframes>
<body bgcolor="#FFFFFF" text="#000000">
</body>
</noframes>
</html>
-----a.htm------
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language=JavaScript type=text/JavaScript>
<!--
function myform()
{
alert("请输入您的密码!");
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
http://cnfsco.126.com
</body>
</html>
----b.htm----
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<input type="button" name="Submit" value="按钮" onclick="parent.mainFrame.myform();">
</body>
</html>