Accountability Posted October 31, 2017 Report Share Posted October 31, 2017 I have a field [@field:Expiration_Date] . I would like to display a small 75 x 50 graphic "Expired" using JavaScript in an Html Block only if Today() is greater than the expiration date. This is a results page where rules are not available. I am pretty sure this can be done with an <img> tag, JavaScript and an Html Block. I just don't know the proper syntax. Would appreciate any help ? Thanks You ! Unsuccessfully Tried This: <script> expired = [@field:Employee_Doc_Date_Plus_Renew*].value; today=[@field:Date_Time_Stamp*].value; if (expired < today) { <img alt="" src="https://www.mysite.net/Expired_76x50.png" style="width: 76px; height: 50px;" /> ; } </script> Quote Link to comment Share on other sites More sharing options...
Accountability Posted November 1, 2017 Author Report Share Posted November 1, 2017 Took me a while to figure out. Here is what worked for me if anyone else needs it. <script> var now = new Date(); var expiration = new Date("[@field:Employee_Doc_Date_Plus_Renew*]"); if(now > expiration) // today is after expiration document.write("<IMG ALIGN='center' "+ "SRC='https://My URL/Expired_76x50.png'> "); </script> You will need to replace My URL with the actual URL where your image resides as well as your actual @field references. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.