Guest Piero Posted October 13, 2005 Share Posted October 13, 2005 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 More sharing options...
Chocolate570 Posted October 14, 2005 Share Posted October 14, 2005 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now