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="im gSize('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,my Img)
{
var myDiv= document.getEle mentById(myID); //get correct <div>
var myImage=documen t.getElementByI d(myImg); //get correct <img>
var myWidth=myImage .style.width; //attempt to capture width of <img>
var myHeight=myHeig ht.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
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="im gSize('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,my Img)
{
var myDiv= document.getEle mentById(myID); //get correct <div>
var myImage=documen t.getElementByI d(myImg); //get correct <img>
var myWidth=myImage .style.width; //attempt to capture width of <img>
var myHeight=myHeig ht.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
Comment