Shonumi Posted September 19, 2007 Share Posted September 19, 2007 Couldn't help but notice that W3Schools does not include a section about creating the Image Object in JavaScript. Arrays, Boolean, String, Math, and others are certainly there. But I don't notice that it has anything about the Image Object. While granted, it's not the most quintessential thing out there, it shouldn't wholly be missing. At the very least, it makes the site all that more comprehensive. Just thought it was strange, as the JS Section doesn't seem complete, as there are several functions associated with the Image Object too, so it's not really a minor detail. Link to comment Share on other sites More sharing options...
aspnetguy Posted September 20, 2007 Share Posted September 20, 2007 The image object is just a wrapper for the <img> tag. So the image object has all the same properties as the tag var img = new Image();//same as using DOM//var img = document.createElement("img");img.src="yourimage.gif";img.border = "0";img.alt = "Alt text";//etc,etc Using the DOM is the recmmended way although it really makes no difference. Link to comment Share on other sites More sharing options...
Shonumi Posted September 22, 2007 Author Share Posted September 22, 2007 Okay, that's fine. I just didn't see the Image Object with the rest of them (silly me). But I didn't see the HTML DOM way on how to create elements. The method createElement() is only found in the XML DOM tutorial but not the HTML DOM, which was part of the problem in me not recognizing the JS image object page was there. Since the DOM way is recommended, there could at least be an example of createElement() used for HTML. Perhaps I'm just blind like before, but I can't find it anywhere but in the XML DOM tutorial. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.