根据日期显示图像VB脚本

问题描述:

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

I am extremely new to VB Script, and any help is extremely appreciated.

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

I currently have 4 images that need to be displayed based on the date. I have named each image as 1,2,3 and 4. I am using the date function to display this but I am getting a 500 error message. If there is a better way to accomplish this with VBScript please let me know. The images are in a folder specified in the path for the src inside the div and the extension of the images is 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> 

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

I think your problem is with your 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>