框架也内,子页JS调用母页面的JS。

母页面default.aspx;子页面b.aspx,c.aspx。

 

<!-- default.aspx-->
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
    <script type="text/javascript">
    function parentshow()
    {
        alert("parent");
    }
    </script>
</head>
<frameset border="0" framespacing="0" frameborder="0" rows="124,*" cols="*">
<frame name="b" src="b.aspx">
<frame name="c" src="c.aspx">
</frameset>
</html>


<!-- b.aspx-->

 


<!-- c.aspx-->
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
    <script type="text/javascript">
    function childclick()
    {
        window.parent.eval("parentshow()");
    }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <input id="btn" onclick="childclick()" type="button" value="btn" ></input>
    </div>
    </form>
</body>
</html>

posted on 2008-11-13 17:37  Sail  阅读(1055)  评论(2编辑  收藏  举报

最新资讯 最新游戏 最新网页游戏