不是跳出来 我没懂你到底要实现什么样的其实你就当成普通的验证来做就行了 比如我们要求用户名是admin 密码是12345才能进<% If session("login")<>true Then If request.form("user")="admin" And request.form("pass")="12345" Then session("login")=true Else response.write("<script>alert('没有权限')</script>") End if End if If session("login")<>true Then %> <FORM METHOD=POST ACTION=""> 用户名:<INPUT TYPE="text" NAME="user"><BR> 密码:<INPUT TYPE="text" NAME="pass"><BR> <INPUT TYPE="submit" VALUE="提交"> </FORM> <% else response.write("显示本页内容") End if %>
<html> <head> <script type="text/javascript"> function disp_prompt() { var password=prompt("请输入您的名字","***") if (password=="123") { window.location="/index.html" } else { document.write("密码错误"); } } </script> </head> <body> <a href="#" onClick="disp_prompt()">Hello</a> </body> </html>
比如我们要求用户名是admin 密码是12345才能进<%
If session("login")<>true Then
If request.form("user")="admin" And request.form("pass")="12345" Then
session("login")=true
Else
response.write("<script>alert('没有权限')</script>")
End if
End if
If session("login")<>true Then
%>
<FORM METHOD=POST ACTION="">
用户名:<INPUT TYPE="text" NAME="user"><BR>
密码:<INPUT TYPE="text" NAME="pass"><BR>
<INPUT TYPE="submit" VALUE="提交">
</FORM>
<%
else
response.write("显示本页内容")
End if
%>
<head>
<script type="text/javascript">
function disp_prompt()
{
var password=prompt("请输入您的名字","***")
if (password=="123")
{
window.location="/index.html"
}
else
{
document.write("密码错误");
}
}
</script>
</head>
<body>
<a href="#" onClick="disp_prompt()">Hello</a>
</body>
</html>
是通过配置应用的认证与授权实现的。
J2EE中可以配置web.xml中的security-constraint属性。
别的环境下不了解。
这个我试过了,可以用,但用再我做的网页上,因为跳转的页面是动态页面,页面链接是 delete.asp?ID=<%Response.Write ID%>
如果在程序里写成这样的话感觉好像不对window.location="delete.asp?ID=<%Response.Write ID%>"
还应该怎么修改
<head>
<script type="text/javascript">
function disp_prompt()
{
var password=prompt("请输入您的名字","***")
if (password=="123")
{
window.location="delete.asp?ID= <%Response.Write ID%>"
}
else
{
document.write("密码错误");
}
}
</script>
</head>
<body>
<a href="#" onClick="disp_prompt()">Hello </a>
</body>
</html>
没有错吗?我怎么跳转失败 跳转的地址没delete.asp?ID=后面就没了