JavaScript image naturalHeight


<img src=../images/top2.jpg  align='right' id=my_image >
Let us start with reading the naturalHeight of the image
var y=document.getElementById("i1").naturalHeight;
Here i1 is the image object.

naturalHeight of an image object returns the actual height of the image irrespective of its change by any style property. By using height we will get value after any style or DHTML is applied. Here is the code.
document.getElementById("i1").width=document.getElementById("i1").naturalWidth;
document.getElementById("i1").height=document.getElementById("i1").naturalHeight;


plus2net.com




More on JavaScript Image Object
Image SlideShow Script using navigational buttons
Image Loading to cache while page load by Image object
Reloading the image without refreshing the page
Image Rotator Script for automatic Slideshow
Image Move across by button click
Image Move continuously across screen
Image offSetLeft and offSetTop to get position of the image from left and top
Image Position : Positioning an image by assigning value to style.top and style.left
Image width: Managing width of the image
Image height: managing height of the image
Image align: Image align left or right
Image border: adding and removing border from Image
Image alt: updating or reading alt message of image

Post your comments , suggestion , error , requirements etc here .




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer