JavaScript image object![]() <img src=../images/top2.jpg alt='plus2net.com tutorial site' align='right' id=my_image border=2 height=30 width=150>Using above image, we can create one image object like this.
Using this object we can get these details . <script language='JavaScript' type='text/JavaScript'> <!-- var x=document.getElementById('my_image'); // create Image object document.write('<br>Height:'+x.height); document.write('<br>Width:'+x.width); document.write('<br>naturalHeight:'+x.naturalHeight); document.write('<br>naturalWidth:'+x.naturalWidth); document.write('<br>Alt text:'+x.alt); document.write('<br>Border:'+x.border); document.write('<br>Align:'+x.align); document.write('<br>offsetTop:'+x.offsetTop); document.write('<br>offsetLeft:'+x.offsetLeft); //--> </script>
Applications and Demo scripts using Image Object in JavaScript
This article is written by plus2net.com team.
![]() | ||||||||||||||||||||
More on JavaScript Image Object![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | ||||||||||||||||||||