应该是一个团队。
layer是一个开源免费的弹出层组件,简单易用、美观,功能强大能够满足你对弹出层的几乎所有需求,每一种模式都有自己的特色,调用简单实用性强,可轻松实现Alert、Confirm、Prompt、普通提示、页面区块、iframe、tips等几乎所有的弹出模式。
jsp中的注册弹出新窗口是通过window.open一个新页面来实现的。
页面register.jsp代码如下:
<%@ page contentType=text/html; charset=gb2312 language=java import=cn.wy.Pet.User errorPage= %>
<!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN >
<html xmlns=>
<head>
<meta http-equiv=Content-Type content=text/html; charset=gb2312 />
<title>会员注册例子讲解</title>
<style type=text/css>
<!--
.STYLE1 {
color: #FF0000;
font-weight: bold;
}
.STYLE2 {color: #FF0000}
.STYLE3 {
font-size: 18px;
font-weight: bold;
}
-->
</style>
</head>
<body style=font-size:12px>
<form id=form1 name=form1 method=post action=<%=actionStr%>reg>
<p align=center><br />
<span class=STYLE3>用户注册</span></p>
<table width=582 height=302 border=1 align=center cellpadding=0 cellspacing=0 bordercolor=#BCACD2>
<tr>
<td width=80 align=right>用户名:</td>
<td width=496 align=left><input name=userName type=text id=userName size=16 maxlength=16 />
<span class=STYLE1>*</span> 3~16位字母或者数字(如:8hack)</td>
</tr>
<tr>
<td align=right>密码:</td>
<td align=left><input name=password1 type=text id=password1 size=16 maxlength=16 />
<span class=STYLE1>* </span> 3~16位字母或者数字(如:abc123)</td>
</tr>
<tr>
<td align=right>确认密码:</td>
<td align=left><input name=password2 type=text id=password2 size=16 maxlength=16 />
<span class=STYLE1>*</span> 必须和上面输入的密码相同</td>
</tr>
<tr>
<td align=right>电子邮件:</td>
<td align=left><input name=email type=text id=email maxlength=20 />
<span class=STYLE1>*</span> 找回密码和联系用(如:8hack@163.com)</td>
</tr>
<tr>
<td align=right>联系电话:</td>
<td align=left><input name=tel type=text id=tel size=20 maxlength=20 />
如(,)</td>
</tr>
<tr>
<td align=right>联系地址:</td>
<td align=left><input name=address type=text id=address maxlength=50 /></td>
</tr>
<td height=40 colspan=2 align=center><input type=submit name=Submit value=确认注册 />
<input type=reset name=Submit2 value=重新填写 /></td>
</tr>
</table>
</form>
</body>
</html>
后台servlet的处理:
public class reg extends HttpServlet
{
public reg()
{
}
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
PrintWriter out;
DBConnection dbc=null;
String userName;
String psd;
String email;
String tel;
String address;
int popedom;
response.setContentType(text/html;charset=UTF-8);
out = response.getWriter();
try{
dbc = new DBConnection();
PreparedStatement ps = null;
userName = request.getParameter(userName);
psd = login.encrypt(request.getParameter(password1).toString());
email = request.getParameter(email);
tel = request.getParameter(tel);
address = request.getParameter(address);
popedom = Integer.parseInt(request.getParameter(popedom));
if (userName != null && psd != null && email != null)
{
ps = dbc.getCon().prepareStatement(insert into [User](UName,Upass,UEmail,UTel,UAddress,UPopedom) values(?,?,?,?,?,?));
ps.setString(1, userName);
ps.setString(2, psd);
ps.setString(3, email);
ps.setString(4, tel);
ps.setString(5, address);
ps.setInt(6, popedom);
ps.execute();
System.out.print(新用户注册: + request.getParameter(userName) + );
out.print(<script>alert('恭喜您:注册成功!现已经登录到网站!');history.go(-1)</script>);
}
if (dbc != null)
dbc.dbClose();
}
catch(SQLException ex)
{
out.print(<script>alert('注册失败!数据库连接错误!');history.go(-1)</script>);
ex.printStackTrace();
if (dbc != null)
dbc.dbClose();
}
}
}
<!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN >
<html xmlns=>
<head>
<meta http-equiv=Content-Type content=text/html; charset=gb2312 />
<title>无标题文档</title>
<script type=text/javascript>
function ShopConfirm(str){
var ShopConfirmLayer=document.getElementById(str);
var webBgLayer=document.getElementById(webBgLayer);
// ShopConfirmLayer.innerHTML=str;
ShopConfirmLayer.style.display=;//显示内容层,显示覆盖层
ShopConfirmLayer.style.left=parseInt((document.documentElement.scrollWidth-ShopConfirmLayer.offsetWidth)/2)+document.documentElement.scrollLeft+px;
ShopConfirmLayer.style.top=Math.abs(parseInt((document.documentElement.clientHeight-ShopConfirmLayer.offsetHeight)/2))+document.documentElement.scrollTop+px; //为内容层设置位置
webBgLayer.style.display=;
webBgLayer.style.height=document.documentElement.scrollHeight+px; //为覆盖层设置高度
}
function CloseShopConfirm(ids){
var ShopConfirmLayer=document.getElementById(ids);
var webBgLayer=document.getElementById(webBgLayer);
ShopConfirmLayer.style.display=none;
webBgLayer.style.display=none;
}
function hide(id)
{
var ids=document.getElementById(id);
ids.style.display='none';
}
</script>
</head>
<body style= height:95%;>
<input type=button value=test onclick=ShopConfirm('img3') />
<div id=img3 style=position:absolute;top:343px;left:129px; background:#F7ECF9; font-size:14px; color:black;z-index:900; border:2px #FFCC00 solid; width:350px; height:220px; padding:9px;>
<div style=width:350px; text-align:right;><div style= color:#9900CC; font-weight:bold; font-size:15px; cursor:hand; onclick=CloseShopConfirm('img3')>关 闭</div></div>
<br/><br/><br/><br/><br/> 在这里设置注册按钮
</div>
</div><script language=javascript>hide('img3');</script>
<div id=webBgLayer style=position:absolute;top:0px;left:0px;z-index:899;background-color:black;height:100%;width:100%;display:none;-moz-opacity:0.9;filter:alpha(opacity=50);></div>
</body>
</html>
专门帮你做的,记得给分哈。
window.open()..........
姓 名:
联系电话:
留言备注:
我要留言(留言后专人第一时间快速对接)
已有 1826 企业通过我们找到了合作项目