I have a Visual Studio 2005 site which has been up a running for a while. I have an image (.JPG) on this site that I think I need to apply some JavaScript to or something?
Essentially I have 25 images for the month of December and instead of going into the site daily to change this image to another one I was hoping to be able to complete this by code automatically.
I have some .NET skills but I think that I might needs to use JavaScript to complete this task. Can anyone point me in the right direction or provide me with some sample code that could help?
I think the simplest way would be to rename all images to things like “December1.jpg”, “December2.jpg”, “December3.jpg” etc. Then server-side you would have this:
This would just add the day of the month to your image name. There are fancier ways to do it, but for a one-time-deal, you can’t get much simpler than this.
EDIT:
You might also throw in an “if exists” for your images so that on the 26th you don’t end up with a 404 image. Something like this:
Change your image to add an id and default it to hidden:
Then on the code behind:
For more on that go here: http://www.dotnetperls.com/file-exists