simple background color change on click then after delay change back.
Hi all, here's the background on what I'm doing: I'm making a photo gallery that you interact with on the touch screen of a camera on screen, I know that sounds confusing, but it makes sense visually. Anywho I have an image of a camera, and what I'd like to do just for fun is make it so it looks like the "flash" went off on the camera when you click on the take picture button. As well as play a short audio clip.
Anywho I'm mainly trying to figure out how to just get the background to switch and then after a tiny delay switch back.
Here's the code that I have for it
Then in my page i currently have a button(I'm going to make it a selectable div or image map so there isn't an ugly button over the camera's button, but that's not important at the moment)
<script> function ChangeBackground()
document.body.style.backgroundColor="white"; //immediately change the background color to white
setTimeout(document.body.style.backgroundColor="#000000", 100) //after 100 milliseconds change the background to black.
Can anyone point out why this code does not work? When I run it, the background doesn't change at all.
<input type="button" onclick="ChangeBackground()" Value="Flash"/>