点击超链接,弹出需要用户名和密码验证的对话框,js实现 对话框里面有:用户名,密码,提交按钮。 就像百度一样,当你单击下载时如果你没有登录,提示需要登录的对话框。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 从session里取用户名和密码 如果没有 就提示让先登录 jquery 的模式对话框 在百度上搜一下 有例子 有教程 弱弱的问下,这不是还要经过数据库那验证的么,不该用AJAX么 点击下载判断一下,然后如果没有登录的话就用浮动窗口弹出一个table来让用户输入吧。判断的话可以在浏览器那边判断,比如session里面是不是有用户的登录信息封装的一个类什么的,浮动窗口的话代码在网上有的,自己去找下就行了 <a href="#" onclick="your function"/>function1、弹出div2、ajax验证 如果是我的话 我选择用一个过滤器filter 如果session中没有这个用户名的话就跳转到登陆页面 我把我的问题重复一下,就是当你单击超链接的时候,像alert();一样,提示一个对话框,但我要的这个对话框,里面必须有用户、密码、提交按钮。 前面的兄弟说session,可以验证,先登录,但你怎么样让页面显示一个对话框呢? div 可以实现一个框架,但他在div style="display:none" 只能设置为隐藏,当你提交按钮时,就是显示div隐藏的东西,却没有实现我这个效果。 filter只能是在用户登录的时候用 session 点击超链 进行判断 session是否为空 然后弹出 窗口 不为空在登录框输出session值 点提交再进行session判断是否为空 不为空登录成功,为空提示用户名密码不能空 或者用户名密码进行查询判断 是这样吗? 就是 不知道怎么用CSS,还有div来设置这个提示窗口,窗口里面有用户和密码,还有提交按钮 一个小例子,供参考:<style type="text/css">#aaa{ position:absolute; display:none; width:200px; height:100px; background-color:#FFFFFF; border:1px #CCCCCC solid;}#b{ height:30px; text-align:right; line-height:30px; padding-left:30px; font-size:12px; border-bottom:1px #CCCCCC solid; width:400px;; float:left; cursor:hand;}#c{ height:20px; text-align:left; font-size:12px; border-bottom:1px #CCCCCC solid; line-height:20px; width10%; float:left;}#d{ font-size:12px; padding:10px; line-height:23px;}#e{ width:100%; height:20px; line-height:20px; text-align:center;}</style> <div id="aaa"> <div id="b" onmousedown="startDrag(this)" onmouseup="stopDrag(this)" onmousemove="drag(this)"><span style="text-decoration:underline; cursor:hand; padding-right:2px;" onclick="d()">关闭</span></div> <div class="clear"></div> <div id="d"><table border="0" width="100%" cellspacing="0" cellpadding="0" > <tr> <td width="100%" > <form action="" name="sdfdasfds" method="post"> <table align="center" bgColor="#777777" border="0" cellPadding="0" cellSpacing="0" width="100%"> <tbody> <tr> <td bgcolor="#FFFFFF"> <table border="0" cellPadding="3" cellSpacing="1" width="100%"> <tbody> <tr align="middle"></tr> <tr bgColor="#ffffff"> <td width="11%" nowrap bgcolor="#FFFFFF"><font size="2">账号:</font></td> <td width="89%" bgcolor="#FFFFFF"><font size="2"> <input type="text" name="username" size="30" maxLength="8"></font></td> </tr> <tr bgColor="#ffffff"> <td width="11%" nowrap bgcolor="#FFFFFF"><font size="2">密码:</font></td> <td width="89%" bgcolor="#FFFFFF"><font size="2"> <input type="password" name="password" size="30" maxLength="20"></font></td> </tr> <tr bgColor="#ffffff"> <td width="11%" nowrap bgcolor="#FFFFFF"> </td> <td width="89%" bgcolor="#FFFFFF"><input name="Submit"" onClick="return checkPub()" type="submit" value="登陆"> <input name="Clear" type="reset" value="取消"></td> </tr> <tr align="middle"></tr> </tbody> </table> </td> </tr> </tbody> </table> </form></td> </tr> </table> </div></div><script language="javascript">function d(){ $("aaa").style.display="none";}function c(){ $("aaa").style.display="block"; $("aaa1").style.display="none"; $("aaa").style.left="600px"; $("aaa").style.top="300px";}function $(id){ return document.getElementById(id);}</script><script> var x0=0,y0=0,x1=0,y1=0; var moveable=false; //开始拖动; function startDrag(obj){ if(event.button==1){ obj.setCapture(); var win = obj.parentNode; x0 = event.clientX; y0 = event.clientY; x1 = parseInt(win.offsetLeft); y1 = parseInt(win.offsetTop); moveable = true; } } //拖动; function drag(obj){ if(moveable){ var win = obj.parentNode; win.style.left = x1 + event.clientX - x0; win.style.top = y1 + event.clientY - y0; } } //停止拖动; function stopDrag(obj){ if(moveable){ obj.releaseCapture(); moveable = false; } } </script> <a href="#" onclick="javascript:c();" style="cursor:hand; background:#F39700; color:#FFFFFF; font-size:20px;"> 我要发帖</a> window.open 打开输入验证页面 JSP页面显示问题,在线等!!! 在servlet中查找目录文件的问题 新手提问:向hashMap里添加数据的问题 最近公司比较闲,求兼职,不收钱!!!!!!!!!!!!!!!! ?传值变成???????? 求解? 北京的大哥们请进。。。。。有分贡上!!!!!!!!!!! Struts2 对表单如何验证 jspsmart好用吗??参数是怎么设置啊?? 请教messages.getString("Resource")如果.properties文件里没有Resource,那将返回什么?? 简单问题,160分相赠!!! 关于document.cookie的一个问题 项目上线步骤?
判断的话可以在浏览器那边判断,比如session里面是不是有用户的登录信息封装的一个类什么的,
浮动窗口的话代码在网上有的,自己去找下就行了
1、弹出div
2、ajax验证
filter 如果session中没有这个用户名的话就跳转到登陆页面
前面的兄弟说session,可以验证,先登录,但你怎么样让页面显示一个对话框呢?
div 可以实现一个框架,但他在div style="display:none" 只能设置为隐藏,当你提交按钮时,就是显示div隐藏的东西,却没有实现我这个效果。
filter只能是在用户登录的时候用 session
#aaa{
position:absolute;
display:none;
width:200px;
height:100px;
background-color:#FFFFFF;
border:1px #CCCCCC solid;
}
#b{
height:30px;
text-align:right;
line-height:30px;
padding-left:30px;
font-size:12px;
border-bottom:1px #CCCCCC solid;
width:400px;;
float:left;
cursor:hand;
}
#c{
height:20px;
text-align:left;
font-size:12px;
border-bottom:1px #CCCCCC solid;
line-height:20px;
width10%;
float:left;
}
#d{
font-size:12px;
padding:10px;
line-height:23px;
}
#e{
width:100%;
height:20px;
line-height:20px;
text-align:center;
}
</style>
<div id="aaa">
<div id="b" onmousedown="startDrag(this)" onmouseup="stopDrag(this)" onmousemove="drag(this)"><span style="text-decoration:underline; cursor:hand; padding-right:2px;" onclick="d()">关闭</span></div>
<div class="clear"></div>
<div id="d">
<table border="0" width="100%" cellspacing="0" cellpadding="0" >
<tr>
<td width="100%" > <form action="" name="sdfdasfds" method="post">
<table align="center" bgColor="#777777" border="0" cellPadding="0" cellSpacing="0" width="100%">
<tbody>
<tr>
<td bgcolor="#FFFFFF">
<table border="0" cellPadding="3" cellSpacing="1" width="100%">
<tbody>
<tr align="middle"></tr>
<tr bgColor="#ffffff">
<td width="11%" nowrap bgcolor="#FFFFFF"><font size="2">账号:</font></td>
<td width="89%" bgcolor="#FFFFFF"><font size="2">
<input type="text" name="username" size="30" maxLength="8"></font></td>
</tr>
<tr bgColor="#ffffff">
<td width="11%" nowrap bgcolor="#FFFFFF"><font size="2">密码:</font></td>
<td width="89%" bgcolor="#FFFFFF"><font size="2">
<input type="password" name="password" size="30" maxLength="20"></font></td>
</tr>
<tr bgColor="#ffffff">
<td width="11%" nowrap bgcolor="#FFFFFF"> </td>
<td width="89%" bgcolor="#FFFFFF"><input name="Submit"" onClick="return checkPub()" type="submit" value="登陆">
<input name="Clear" type="reset" value="取消"></td>
</tr>
<tr align="middle"></tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</form></td>
</tr>
</table>
</div>
</div>
<script language="javascript">
function d()
{
$("aaa").style.display="none";
}
function c()
{
$("aaa").style.display="block";
$("aaa1").style.display="none";
$("aaa").style.left="600px";
$("aaa").style.top="300px";
}
function $(id)
{
return document.getElementById(id);
}
</script>
<script>
var x0=0,y0=0,x1=0,y1=0;
var moveable=false;
//开始拖动;
function startDrag(obj){
if(event.button==1){
obj.setCapture();
var win = obj.parentNode;
x0 = event.clientX;
y0 = event.clientY;
x1 = parseInt(win.offsetLeft);
y1 = parseInt(win.offsetTop);
moveable = true;
}
}
//拖动;
function drag(obj){
if(moveable){
var win = obj.parentNode;
win.style.left = x1 + event.clientX - x0;
win.style.top = y1 + event.clientY - y0;
}
}
//停止拖动;
function stopDrag(obj){
if(moveable){
obj.releaseCapture();
moveable = false;
}
} </script>
<a href="#" onclick="javascript:c();" style="cursor:hand; background:#F39700; color:#FFFFFF; font-size:20px;"> 我要发帖</a>