kyozoku
09-22-2005, 02:11 AM
Hello,
I am having a problem getting this script to work. What I want to do is resize each image having the name "Resizeable" once the page has loaded. THe images need to be 250px wide but they are of varying dimensions so the height has to be determined by finding the change in width. The page is at www.itailers.com/auction-template.html , I know there are style issues happening but I can fix those later.
The script I am using is
<script type="text/javascript">
function imgResize()
{
var Children = document.getElementsByName("Resizeable");
var Endpoint = Children.Length;
//Go through all images and resize them accordingly.
for (var i = 0; i < Endpoint; ++i)
{
var currWidth = Children[i].style.width;
document.write("currWidth");
var currHeight = Children[i].style.height;
var Width = 250;
var Factor = currWidth/Width;
Children[i].style.width = currWidth * Factor;
Children[i].style.height = currHeight * Factor;
}
}
</script>
I am calling the function like this
<body onLoad="imgResize()">
Any idea why this won't work in either IE or Fx?
I am having a problem getting this script to work. What I want to do is resize each image having the name "Resizeable" once the page has loaded. THe images need to be 250px wide but they are of varying dimensions so the height has to be determined by finding the change in width. The page is at www.itailers.com/auction-template.html , I know there are style issues happening but I can fix those later.
The script I am using is
<script type="text/javascript">
function imgResize()
{
var Children = document.getElementsByName("Resizeable");
var Endpoint = Children.Length;
//Go through all images and resize them accordingly.
for (var i = 0; i < Endpoint; ++i)
{
var currWidth = Children[i].style.width;
document.write("currWidth");
var currHeight = Children[i].style.height;
var Width = 250;
var Factor = currWidth/Width;
Children[i].style.width = currWidth * Factor;
Children[i].style.height = currHeight * Factor;
}
}
</script>
I am calling the function like this
<body onLoad="imgResize()">
Any idea why this won't work in either IE or Fx?