rlemon
10-14-2005, 01:44 AM
<html>
<head>
<script type='text/javascript'>
function init() {
for(var i=0; imgEle=document.getElementsByTagName('img')[i];i++)
if (imgEle.height > 500){ imgEle.width = Math.round(((500)/imgEle.height)*imgEle.width); imgEle.height = (500); }
document.getElementsByTagName('input')[0].focus();
}
</script>
</head>
<body onload="init()">
</body>
</html>
however i think there is more wrong with your code. the for loop looks a little off.
<head>
<script type='text/javascript'>
function init() {
for(var i=0; imgEle=document.getElementsByTagName('img')[i];i++)
if (imgEle.height > 500){ imgEle.width = Math.round(((500)/imgEle.height)*imgEle.width); imgEle.height = (500); }
document.getElementsByTagName('input')[0].focus();
}
</script>
</head>
<body onload="init()">
</body>
</html>
however i think there is more wrong with your code. the for loop looks a little off.
