求教asp中if语句的格式
麻烦大能给看下页面中我的if语句这样写是否正确<tdalign="center"><scriptlanguage="JavaScript"><%dimpicpic=req...
麻烦大能给看下页面中我的if语句这样写是否正确
<td align="center">
<script language = "JavaScript">
<%dim pic
pic=request.QueryString("BigClassID")
if pic="16" then response.Write "<img src='images/1.jpg' width='700' height='165' />"
if pic="24" then response.Write "<img src='images/2.jpg' width='700' height='165' />"
if pic="25" then response.Write "<img src='images/3.jpg' width='700' height='165' />"
else response.Write "<img src='images/4.jpg' width='700' height='165' />"
end if%></script></td> 展开
<td align="center">
<script language = "JavaScript">
<%dim pic
pic=request.QueryString("BigClassID")
if pic="16" then response.Write "<img src='images/1.jpg' width='700' height='165' />"
if pic="24" then response.Write "<img src='images/2.jpg' width='700' height='165' />"
if pic="25" then response.Write "<img src='images/3.jpg' width='700' height='165' />"
else response.Write "<img src='images/4.jpg' width='700' height='165' />"
end if%></script></td> 展开
2个回答
展开全部
不对,看你的意思,应该是想写成
if pic="16" then response.Write "<img src='images/1.jpg' width='700' height='165' />"
elseif pic="24" then response.Write "<img src='images/2.jpg' width='700' height='165' />"
elseif pic="25" then response.Write "<img src='images/3.jpg' width='700' height='165' />"
else response.Write "<img src='images/4.jpg' width='700' height='165' />"
end if
如果之前你写的,若pic=16,会执行response.Write "<img src='images/1.jpg' width='700' height='165' />" 和 response.Write "<img src='images/4.jpg' width='700' height='165' />"两条
而且你有三个if只有一个end if 程序都无法正常的执行…………
if pic="16" then response.Write "<img src='images/1.jpg' width='700' height='165' />"
elseif pic="24" then response.Write "<img src='images/2.jpg' width='700' height='165' />"
elseif pic="25" then response.Write "<img src='images/3.jpg' width='700' height='165' />"
else response.Write "<img src='images/4.jpg' width='700' height='165' />"
end if
如果之前你写的,若pic=16,会执行response.Write "<img src='images/1.jpg' width='700' height='165' />" 和 response.Write "<img src='images/4.jpg' width='700' height='165' />"两条
而且你有三个if只有一个end if 程序都无法正常的执行…………
展开全部
错误的
正确应该是这样
<%dim pic
pic=request.QueryString("BigClassID")
if pic="16" then response.Write "<img src='images/1.jpg' width='700' height='165' />" else
if pic="24" then response.Write "<img src='images/2.jpg' width='700' height='165' />" else
if pic="25" then response.Write "<img src='images/3.jpg' width='700' height='165' />"
else response.Write "<img src='images/4.jpg' width='700' height='165' />"
end if%></script></td>
正确应该是这样
<%dim pic
pic=request.QueryString("BigClassID")
if pic="16" then response.Write "<img src='images/1.jpg' width='700' height='165' />" else
if pic="24" then response.Write "<img src='images/2.jpg' width='700' height='165' />" else
if pic="25" then response.Write "<img src='images/3.jpg' width='700' height='165' />"
else response.Write "<img src='images/4.jpg' width='700' height='165' />"
end if%></script></td>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询