JS框架刷新,iframe父子窗口间js方法调用
原创
©著作权归作者所有:来自51CTO博客作者lishuai052086的原创作品,请联系作者获取转载授权,否则将追究法律责任
Response.Write("<script language=javascript>window.open('x.aspx','main');</script>");
Javascript刷新页面的几种方法:
1 history.go(0)
2 location.reload()
3 location=location
4 location.assign(location)
5 document.execCommand(''Refresh'')
6 window.navigate(location)
7 location.replace(location)
8 document.URL=location.href
框架刷新。
window.parent.frames[leftFrame1].location.reload();
Page.RegisterStartupScript("","<script language'=javascript'>window.parent.frames[leftFrame1].location.reload();
全页面跳转
Response.Write("<script language=javascript>parent.location.href='login.aspx';</script>");
οnclick="window.open('index.aspx','mainFrame');
iframe父子窗口间js方法调用
父窗口调用iframe子窗口方法<iframe name="myFrame" src="child.html"></iframe>
myFrame.window.functionName();
iframe子窗口调用父窗口方法
parent.functionName();
父窗口页面
<html>
<head>
<script type="text/javascript">
function say() {
alert("parent.html------>I'm at parent.html");
}
function callChild()
{
//document.frames("myFrame").f1();
myFrame.window.say();
}
</script>
</head>
<body>
<input type=button value="调用child.html中的函数say()" οnclick="callChild()">
<iframe name="myFrame" src="child.html"></iframe>
</body>
</html>
子窗口页面
<html>
<head>
<script type="text/javascript">
function say()
{
alert("child.html--->I'm at child.html");
}
function callParent() {
parent.say();
}
</script>
</head>
<body>
<input type=button value="调用parent.html中的say()函数" οnclick="callParent()">
</body>
</html>
|