Show image based on date VB Script [duplicate]

人走茶凉 提交于 2020-01-06 07:10:20

问题


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

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> 

回答1:


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> 


来源:https://stackoverflow.com/questions/53103332/show-image-based-on-date-vb-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!