- 论坛徽章:
- 1
|
刚刚做了个代码如下:
文件名:test.htm
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <title>刷新测试</title>
- </head>
- <body>
- 测试内容
- <form id="form1" name="form1" method="post" action="">
- <input name="newwin" type="checkbox" id="newwin" value="newwin" />
- <select name="select">
- </select>
-
- 在新窗口中打开
- <input type="button" name="Submit" value="刷新数据" onclick="check()"/>
- <?php echo date("H:m:s"); ?></form>
- </body>
- </html>
- <script language="JavaScript" type="text/javascript">
- function newwindow(theURL,winName,features) //打开新窗口()
- {
- newwinname=window.open(theURL,winName,features);
- if(!newwinname.closed)//判断窗口是否在最前面
- {
- newwinname.focus();//把新打开的窗口放到最前面
- }
- }
-
- function MM_goToURL() { //转到新页面('parent','delete_stock.php?ty=1')
- var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
- for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
- }
- function check()//检查程序
- {
- if(document.forms['form1'].elements['newwin'].checked==true)//判断是否选中
- {
- newwindow('test.htm','test','status=yes,scrollbars=yes,resizable=yes,width=600,height=400,left=250,top=200');//如果选中 在新窗口中打开
- }
- else
- {
- MM_goToURL('parent','test.htm');//如果没有选中就在本面打开
- }
- }
- </script>
复制代码
你看下是否是你想要的结果 |
|