In a web application, how can I flash an image after a user presses a button?
document.images.src = 'flashedImage.jpg'
var t = setTimeout("hideImage()",250)
document.images.src = 'blank.gif'
When the displayImage function is called, it will change the first image on the page to “flashedImage.jpg”. After 250 milliseconds, it will replace this image with a blank image.
A button like this can be used in the body for the user to click on.
<input type="button" value="Click to view image" onClick="displayImage()" id="displayButton">
images refers to the first image on the page. If you want a different image to flash, replace 0 with the appropriate number (the first image is 0, the second is 1, …).