当前位置:首页 > javascript 框架之间 函数传递

javascript 框架之间 函数传递

点击次数:1444  更新日期:2011-01-04
\n

*********index.htm*******


\n

<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″>
<title>Untitled Document</title>
</head>


\n

<frameset cols=”80,*” frameborder=”NO” border=”0″ framespacing=”0″>
<frame src=”left.htm” name=”leftFrame” scrolling=”NO” noresize>
<frame src=”right.htm” name=”mainFrame”>
</frameset>
<noframes><body>
</body></noframes>
</html>


\n

************left.htm
<html>
<body>
<input type=”submit” name=”Submit” value=”Submit” onClick=”testFunc(‘hello’)”>


\n

<script language=”javascript”>
function testFunc(args){
parent.mainFrame.rightFunc(args);
}
</script>
</body>
</html>


\n

/*********right.htm
<html>
<body>


\n

<script language=”javascript”>
function rightFunc(args){
alert(args);
}
</script>
</body>
</html>


\n

来源:网络

\n