本文主要是介绍子父窗口的操作,递归,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
字符窗口操作:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>子父窗口的操作</title>
</head>
<body>
<script>
var win=null;
function op(){
win=window.open("about:blank","win","width=200,height=200");
win.document.write("<input type='button' value='关闭父窗口' οnclick='window.opener.opener=null;window.opener.close()'>");
win.document.write("<input type='button' value='刷新你窗口' οnclick='window.opener.location.reload()'>");
}
</script>
<input οnclick="op()" value="打开窗口" type="button"><input type="button" value="最小化" οnclick="if(win&&win.open&&!win.closed){win.resizeTo(0,0);win.moveTo(0,window.screen.width);}else alert('还没有打开窗口或已经关闭')"><input type="button" value="最大化" οnclick="if(win&&win.open&&!win.closed){win.moveTo(-4,-4);win.resizeTo(screen.availWidth+8,screen.availHeight+8);}else alert('还没有打开窗口或已经关闭');"><input type=button value="关闭子窗口" οnclick="if(win&&win.open&&!win.closed){win.opener=null;win.close()}else alert('还没有打开窗口或已关闭')"><input type=button value="刷新子窗口" οnclick="if(win&&win.open&&!win.closed){win.location.reload();win.focus()}else alert('窗口还没有打开或已关闭')"><input type="button" value="看子窗口的大小" οnclick="if(win&&win.open&&!win.closed){alert(win.document.body.clientWidth+'*'+win.document.body.clientHeight);win.focus();}else{alert('还没有打开窗口或者已关闭')};">
</body>
</html>
递归
<html>
<head>
<title>javascript递归</title>
<script language="javascript">
var testCase = { sum: 0, run: function(n){ if(n>3){ return 3; } else { n=testCase.run(n+1);alert(n);return n; } }
};
function test(){ var ff=testCase.run(1); alert(ff);
}
</script>
</head> <body>
<input type="button" value="test" οnclick="test()" />
</body>
</html>
这篇关于子父窗口的操作,递归的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!