<img> width height
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

<img> width height

From: News <warren@no_S_P_A_M_wyght.com>
Date: Fri Apr 21 2006 - 23:46:37 CEST

I am trying to be able to manipulate the width and height of an <img> but do
not seem to be able.

"Yes", I know the JavaScript will "not" manip anything, which is ok. I
simply do not know how to capture the width or height. Once I can do that I
can manipulate them.

Here is the HTML for the <img>
<div class="ImgMnp" id="myImg" onmouseover="imgSize('myImg','fpImg)">
<img src="images/FirePlace.jpg" width="480" height="640" id="fpImg" />
</div>

Here is the JavaScript I tried to manipulate the <img>
function imgSize(myID,myImg)
 {
   var myDiv= document.getElementById(myID); //get correct <div>
   var myImage=document.getElementById(myImg); //get correct <img>
   var myWidth=myImage.style.width; //attempt to capture width of <img>
   var myHeight=myHeight.style.height; //attempt to capture height of <img>
   alert("myWidth+, +myHeight"); //show if I this function works
 }

Will someone please tell me what I am doing wrong

-- 
Totus possum, totum Deum.
Totus ero, totum meum.
WSW
Received on Mon May 1 05:13:56 2006