Jump to content

Display Images with JavaScript


Guest Piero

Recommended Posts

Hey, is it possible to display an image in the body of a webpage using JavaScript, so that I can use an "if" statement to determine whether the image is displayed or not?

Link to comment
Share on other sites

Yes, there would be. You would have to just do an <img src=""></img> where you want the image to appear. Then in the javascript section, do document.images[0].src="where image is"And that will make the image appear. Then checkx=document.images[0].srcif(x="what the src is"){alert("The image is displayed!")}else{alert("The image isn't here!")}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...