一个简单的IF嵌套语句,不知道错在哪了,有错误提示!!
代码如下:
<%If Trim(Rs(11,i)) <> " " Then
If Trim(Rs(18,i)) <> " " Then
Response.Write " <a href= ' "&Trim(Rs(18,i))& " ' target= '_blank '> "&Trim(Rs(11,i))& " </a> " Else
Response.Write Rs(11,i)
End If
Else
Response.Write " <a href= 'seeks.asp?pdname= "&Trim(Rs(3,i))& " ' target= '_blank '> 暂无 </a> "
End If
%>
错误提示:
Microsoft VBScript 编译器错误 错误 '800a0412 '
必须是行中的第一个语句
hbnew1.asp,行 210
Response.Write " <a href= ' "&Trim(Rs(18,i))& " ' target= '_blank '> "&Trim(Rs(11,i))& " </a> "
------解决方案--------------------没有看出来.
<%If Trim(Rs(11,i)) <> " " Then
If Trim(Rs(18,i)) <> " " Then
Response.Write " <a href= ' "&Trim(Rs(18,i))& " ' target= '_blank '> "&Trim(Rs(11,i))& " </a> "
Else
Response.Write Rs(11,i)
End If
Else
Response.Write " <a href= 'seeks.asp?pdname= "&Trim(Rs(3,i))& " ' target= '_blank '> 暂无 </a> "
End If
%>
------解决方案--------------------If Trim(Rs(11, i)) <> " " Then
If Trim(Rs(18, i)) <> " " Then
Response.Write " <a href= ' "&Trim(Rs(18, i))& " ' target= '_blank '> "&Trim(Rs(11, i))& " </a> "
Else
Response.Write Rs(11, i)
End If
Else
Response.Write " <a href= 'seeks.asp?pdname= "&Trim(Rs(3, i))& " ' target= '_blank '> 暂无 </a> "
End If
注意else的换行
------解决方案--------------------表面上看起来,这一句
Response.Write " <a href= ' "&Trim(Rs(18,i))& " ' target= '_blank '> "&Trim(Rs(11,i))& " </a> " Else
好像换行了,其实没有换行。我复制到DW中才发现的。
注意书写规范,程序代码已经让人头疼了,那么我们让它摆放整齐一点,让人舒服一点。
------解决方案--------------------Response.Write " <a href= ' "&Trim(Rs(18,i))& " ' target= '_blank '> "&Trim(Rs(11,i))& " </a> "Else
Response.Write " <a href= ' "&Trim(Rs(18,i))& " ' target= '_blank '> "&Trim(Rs(11,i))& " </a> "
Else