js 新开窗口与传递信息案例

来源:互联网 发布:毒药 知乎 编辑:程序博客网 时间:2024/06/05 04:11

设计一个网页,使得打开它时弹出一个全屏的窗口,该窗口中有一个文本框和一个按钮。用户在文本框中输入信息后点击按钮就可以把窗口关闭,而输入的信息却在主网页中显示。


Index.php页


<html>


<head>


<title>主页</title>


</head>


<body onload=” window.open('fullwin.php','roc3000','fullscreen')”>


</body>


<table>


<tr>


<td>


<input type=”text “value=”<?php echo $userinput?>”  name=”show”  id=”show”>


</td>


</tr>


</table>


</html>


fullwin.php页


<html>


<head>


<title>弹出全屏窗口的网页</title>


<script>


<!--


function winclosel(){


window.close();


window.open("index.php","","fullscreen=1");


}


//-->


</script>


</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" scroll="no" >
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td>


<input type=”text “value=”<?php echo $userinput?>”  name=”userinput”  id=”userinput” onclick=”winclose()”>


</td></tr>


<tr><td>


<input type=”summit “value=”<?php echo $userinput?>”  name=”jump”  id=”jump”


Onclik=>
</td></tr>
</table>


</body>


</html>


附:
 toolbar=no 是否显示工具栏,yes为显示;
 menubar,scrollbars 表示菜单栏和滚动栏。
 resizable=no 是否允许改变窗口大小,yes为允许;
 location=no 是否显示地址栏,yes为允许;
 status=no 是否显示状态栏内的信息(通常是文件已经打开),yes为允许;
 width=400 窗口宽度;
 height=300 窗口高度;
 top=0 窗口距离屏幕上方的象素值;
 left=0 窗口距离屏幕左侧的象素值;


 


<form   name="form1"   method="post"   action='main.php'   onsubmit='window.open("","winName","fullscreen=1")'   target=winName>  


<form   name="form1"   method="post"   action=''   onsubmit='window.open("main.php","","fullscreen=1")'>  


window.open("filename","","fullscreen=1");


window.open(Url,'cscedcLogin',"dependent,alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=0,directories=0,fullscreen=1,hotkeys=1,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,z-lock=0,screenX=0,screeny=0,left=0,top=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no");




关闭前一个窗口??   
   window.opener=null;   
  window.close();

0 0
原创粉丝点击