Load Image from If Statement
You can load an image from an if statement in the body if it's between script tags and you use the document.write method to write it into the code. But if you're needing an image to conditionally load, rather than using an if in the body for image loading, you can easily run a function from an onLoad that conditionally loads an image or opens a window with the desired image in it, or you can use an event handler to load the image if the mouse moves or if something is hovered over or clicked. Or use the location object to redirect the visitor to a new page with the image on it.