根据日期显示图像VB脚本

时间:2018-11-01 14:28:52

标签: vbscript asp-classic

我是VB Script的新手,非常感谢您的帮助。

我目前有4张需要根据日期显示的图像。我已将每个图像分别命名为1,2,3和4。我正在使用日期函数来显示此图像,但收到500错误消息。如果有更好的方法可以用VBScript完成此操作,请告诉我。图像位于div内src路径中指定的文件夹中,图像扩展名为PNG。

   <%@LANGUAGE="VBSCRIPT"%> 

<%
Dim CurDate

'CurDate = Month(DATE)
'CurDate =("2018-11-01")
 CurDate =(DATE)    

response.write(CurDate) 

If CurDate = "2018-10-30" THEN
    CurDate = 1
If CurDate = "2018-11-01" THEN
    CurDate = 2

If CurDate = "2018-11-02" THEN
    CurDate = 3

Else CureDate = 4

End If

%>  

     HTML Below


  <div style="padding-left:10px;text-align:center;">
    <img alt="Image- Displaying" border="0" src="http://Path/Default/Pane/imgFolder/<%=CurDate%>.png">
</div> 

1 个答案:

答案 0 :(得分:2)

我认为您的问题出在您的if / else / then。

<%@LANGUAGE="VBSCRIPT"%> 

<%
Dim CurDate

'CurDate = Month(DATE)
'CurDate =("2018-11-01")
 CurDate =(DATE)    

response.write(CurDate) 

If CurDate = "2018-10-30" THEN
    CurDate = 1
elseIf CurDate = "2018-11-01" THEN
    CurDate = 2
elseIf CurDate = "2018-11-02" THEN
    CurDate = 3
Else
    CurDate = 4
End If
%>  

     HTML Below


<div style="padding-left:10px;text-align:center;">
  <img alt="Image- Displaying" border="0" src="http://Path/Default/Pane/imgFolder/<%=CurDate%>.png">
</div>