response.write能否在里面设置if语句
需要在列表菜单里判断用户是男还是女<%ifrs("sex")="0"thenresponse.write"selectd"endif%>前面的代码我已经用asp输出为ht...
需要在列表菜单里判断用户是男还是女
<%
if rs("sex")="0" then
response.write "selectd"
end if
%>
前面的代码我已经用asp输出为html怎么在加入?代码如下
<%'处理显示用户信息然后在修改(修改在下面)
sub editor()
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from user where id="&request("id"),conn,1,1
Response.Write "<form id=""edior"" name=""edior"" method=""post"" action=""user_manage.asp?action=update&id="&rs("id")&""">"&VbCrLf
Response.Write " <table border=""0"">"&VbCrLf
Response.Write " <tr class=""trbg"">"&VbCrLf
Response.Write " <td>id</td>"&VbCrLf
Response.Write " <td>用户名</td>"&VbCrLf
Response.Write " <td>密码</td>"&VbCrLf
Response.Write " <td>QQ</td>"&VbCrLf
Response.Write " <td>电子邮件</td>"&VbCrLf
Response.Write " <td>性别</td>"&VbCrLf
Response.Write " </tr>"&VbCrLf
Response.Write " <tr>"&VbCrLf
Response.Write " <td bgcolor=""#E6EFF8"">"& rs("id") &"</td>"&VbCrLf
Response.Write " <td bgcolor=""#E6EFF8"">"&rs("username")&"</td>"&VbCrLf
Response.Write " <td bgcolor=""#E6EFF8""><input type=""text"" name=""password"" id=""password"" /></td>"&VbCrLf
Response.Write " <td bgcolor=""#E6EFF8""><input type=""text"" name=""qq"" id=""qq"" /></td>"&VbCrLf
Response.Write " <td bgcolor=""#E6EFF8""><input type=""text"" name=""emaile"" id=""emaile"" /></td>"&VbCrLf
Response.Write " <td bgcolor=""#E6EFF8""><select name=""sex"" id=""sex"">"&VbCrLf
Response.Write " <option value=""0"">男</option>"&VbCrLf
Response.Write " <option value=""1"">女</option>"&VbCrLf
Response.Write " </select></td>"&VbCrLf
Response.Write " </tr>"&VbCrLf
Response.Write " <tr>"&VbCrLf
Response.Write " <td colspan=""6"" bgcolor=""#E6EFF8""><input type=""submit"" name=""button3"" id=""button3"" value=""更新"" />"&VbCrLf
Response.Write " <input type=""reset"" name=""button4"" id=""button4"" value=""重置"" /></td>"&VbCrLf
Response.Write " </tr>"&VbCrLf
Response.Write " </table>"&VbCrLf
Response.Write "</form>"&VbCrLf
Response.Write ""&VbCrLf
rs.close
set rs=nothing
response.End()
end sub
%> 展开
<%
if rs("sex")="0" then
response.write "selectd"
end if
%>
前面的代码我已经用asp输出为html怎么在加入?代码如下
<%'处理显示用户信息然后在修改(修改在下面)
sub editor()
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from user where id="&request("id"),conn,1,1
Response.Write "<form id=""edior"" name=""edior"" method=""post"" action=""user_manage.asp?action=update&id="&rs("id")&""">"&VbCrLf
Response.Write " <table border=""0"">"&VbCrLf
Response.Write " <tr class=""trbg"">"&VbCrLf
Response.Write " <td>id</td>"&VbCrLf
Response.Write " <td>用户名</td>"&VbCrLf
Response.Write " <td>密码</td>"&VbCrLf
Response.Write " <td>QQ</td>"&VbCrLf
Response.Write " <td>电子邮件</td>"&VbCrLf
Response.Write " <td>性别</td>"&VbCrLf
Response.Write " </tr>"&VbCrLf
Response.Write " <tr>"&VbCrLf
Response.Write " <td bgcolor=""#E6EFF8"">"& rs("id") &"</td>"&VbCrLf
Response.Write " <td bgcolor=""#E6EFF8"">"&rs("username")&"</td>"&VbCrLf
Response.Write " <td bgcolor=""#E6EFF8""><input type=""text"" name=""password"" id=""password"" /></td>"&VbCrLf
Response.Write " <td bgcolor=""#E6EFF8""><input type=""text"" name=""qq"" id=""qq"" /></td>"&VbCrLf
Response.Write " <td bgcolor=""#E6EFF8""><input type=""text"" name=""emaile"" id=""emaile"" /></td>"&VbCrLf
Response.Write " <td bgcolor=""#E6EFF8""><select name=""sex"" id=""sex"">"&VbCrLf
Response.Write " <option value=""0"">男</option>"&VbCrLf
Response.Write " <option value=""1"">女</option>"&VbCrLf
Response.Write " </select></td>"&VbCrLf
Response.Write " </tr>"&VbCrLf
Response.Write " <tr>"&VbCrLf
Response.Write " <td colspan=""6"" bgcolor=""#E6EFF8""><input type=""submit"" name=""button3"" id=""button3"" value=""更新"" />"&VbCrLf
Response.Write " <input type=""reset"" name=""button4"" id=""button4"" value=""重置"" /></td>"&VbCrLf
Response.Write " </tr>"&VbCrLf
Response.Write " </table>"&VbCrLf
Response.Write "</form>"&VbCrLf
Response.Write ""&VbCrLf
rs.close
set rs=nothing
response.End()
end sub
%> 展开
展开全部
我不知道你的性别的那个字段叫什么名字,我暂时用"xingbie"来代替.你到时候改改
在[[[[rs.open "select * from user where id="&request("id"),conn,1,1 ]]]这一段的下面,加上下面的代码:
if rs("xingbie")="0" then
a="selected=selected"
elseif rs("xingbie")="1" then
b="selected=selected"
end if
这这个代码我在里面加入了变量a和b的显示.你直接把你先写的给替换成下面这段就可以了
Response.Write " <option "&a&" value=""0"">男</option>"&VbCrLf
Response.Write " <option "&b&" value=""1"">女</option>"&VbCrLf
在[[[[rs.open "select * from user where id="&request("id"),conn,1,1 ]]]这一段的下面,加上下面的代码:
if rs("xingbie")="0" then
a="selected=selected"
elseif rs("xingbie")="1" then
b="selected=selected"
end if
这这个代码我在里面加入了变量a和b的显示.你直接把你先写的给替换成下面这段就可以了
Response.Write " <option "&a&" value=""0"">男</option>"&VbCrLf
Response.Write " <option "&b&" value=""1"">女</option>"&VbCrLf
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询