
asp判断语句怎么写?
<%dimheadhead=request.QueryString("aa")%><%ifhead=82then%><!--#includefile="head1.asp...
<% dim head
head=request.QueryString("aa")%>
<%if head=82 then %>
<!--#include file="head1.asp"-->
<%end if%>
<%if head=37 then %>
<!--#include file="headgongye.asp"-->
<%end if%>
<%if head=31 then %>
<!--#include file="headhuodong.asp"-->
<%end if%>
<%if head=88 then %>
<!--#include file="headzonghe.asp"-->
<%end if%>
当AA不等于这几个值的时候,也输出一个页面,怎么写?
http://localhost/cn/products.asp?categoryId=37& &page&aa=37
在地址里包含字段page的时候,让它调出别的东西 怎么判断? 展开
head=request.QueryString("aa")%>
<%if head=82 then %>
<!--#include file="head1.asp"-->
<%end if%>
<%if head=37 then %>
<!--#include file="headgongye.asp"-->
<%end if%>
<%if head=31 then %>
<!--#include file="headhuodong.asp"-->
<%end if%>
<%if head=88 then %>
<!--#include file="headzonghe.asp"-->
<%end if%>
当AA不等于这几个值的时候,也输出一个页面,怎么写?
http://localhost/cn/products.asp?categoryId=37& &page&aa=37
在地址里包含字段page的时候,让它调出别的东西 怎么判断? 展开
4个回答
展开全部
最好在客户端进行检查,在表单提交事件中执行检测
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"">
<html xmlns="">
<head>
<meta name="generator" content=
"HTML Tidy for Linux/x86 (vers 11 February 2007), see " />
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<script >
function checkform()
{
if (document.form1.name.value=="")
{
alert('请输入用户名');
return false;
}
else if (document.form1.content.value=="")
{
alert('请输入密码');
return false;
}
// If the script gets this far through all of your fields
// without problems, it's ok and you can submit the form
return true;
}
</script>
<title>请输入</title>
</head>
<body>
<form name="form1" method="post" action="add_new.asp" id="form1" onSubmit="return checkform()">
帐号<input type="text" name="name"><br />
密码<input type="text" name="content" /><br />
保护<input type="text" name="title" value= "" /><br />
<input type="submit" name="Submit" value="提交" /><input type=
"reset" name="Submit2" value="重置" />
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"">
<html xmlns="">
<head>
<meta name="generator" content=
"HTML Tidy for Linux/x86 (vers 11 February 2007), see " />
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<script >
function checkform()
{
if (document.form1.name.value=="")
{
alert('请输入用户名');
return false;
}
else if (document.form1.content.value=="")
{
alert('请输入密码');
return false;
}
// If the script gets this far through all of your fields
// without problems, it's ok and you can submit the form
return true;
}
</script>
<title>请输入</title>
</head>
<body>
<form name="form1" method="post" action="add_new.asp" id="form1" onSubmit="return checkform()">
帐号<input type="text" name="name"><br />
密码<input type="text" name="content" /><br />
保护<input type="text" name="title" value= "" /><br />
<input type="submit" name="Submit" value="提交" /><input type=
"reset" name="Submit2" value="重置" />
</form>
</body>
</html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你的需求 最好使用 Select case 解决
<%
select case Cdbl(head)
case 82
%>
<!--#include file="head1.asp"-->
<%
case 37
%>
<!--#include file="headgongye.asp"-->
<%
case 31
%>
<!--#include file="headhuodong.asp"-->
<%
Case Else
%>
<!--#include file="??????.asp"-->
<%end select%>
<%
select case Cdbl(head)
case 82
%>
<!--#include file="head1.asp"-->
<%
case 37
%>
<!--#include file="headgongye.asp"-->
<%
case 31
%>
<!--#include file="headhuodong.asp"-->
<%
Case Else
%>
<!--#include file="??????.asp"-->
<%end select%>
追问
知道了,谢谢~~
追答
给分
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<%if head=82 then %>
<!--#include file="head1.asp"-->
<%end if%>
<%if head=37 then %>
<!--#include file="headgongye.asp"-->
<%end if%>
<%if head=31 then %>
<!--#include file="headhuodong.asp"-->
<%end if%>
<%if head=88 then %>
<!--#include file="headzonghe.asp"-->
<%else%>
<!--#include file="aaaaaaaaaaaaa.asp"-->
<%end if%>
<!--#include file="head1.asp"-->
<%end if%>
<%if head=37 then %>
<!--#include file="headgongye.asp"-->
<%end if%>
<%if head=31 then %>
<!--#include file="headhuodong.asp"-->
<%end if%>
<%if head=88 then %>
<!--#include file="headzonghe.asp"-->
<%else%>
<!--#include file="aaaaaaaaaaaaa.asp"-->
<%end if%>
追问
这个行不通,写了这个else, 在HEAD= 37 31 82的时候 会出现两个调用的页。
追答
可以设置一个总的IF语句
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
对,用select case 是正确的选择
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询