In a web application, how can I flash an image after a user presses a button?
This can be done using javascript. After the
tag, add these functionsfunction displayImage()
{
document.images0.src = ‘flashedImage.jpg’
var t = setTimeout(“hideImage()”,250)
}
function hideImage()
{
document.images0images[0].src = ‘'blank.gif’
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.
images0 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, …).