---------------------原始代码-------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body οnlοad=window.smallslot.width=show();>
<script>
function show()
{
var w,h;
var k;
var con;
w=smallslot.width;
h=smallslot.height;
k=w/h;
if(k>=1)
{
if (w>=400)
{
w=400;
h=w/k;
}
}
else
{
if (h>=300)
{
h=300;
w=k*h;
}
}
return w;
}
</script>
<SCRIPT>
function bbimg(o){
var zoom=parseInt(o.style.zoom, 10)||100;zoom+=event.wheelDelta/12;if (zoom>0) o.style.zoom=zoom+'%';
return false;
}
</script>
<img border=0 ID=smallslot src=dogs.jpg align=left onmousewheel="return bbimg(this)" >
</body>
</html>
------------------------------------------------------------------------------------------------------------------------
改进后的。
<script>
function show(obj)
{
var w,h;
var k;
var con;
w=obj.width;
h=obj.height;
k=obj.width/obj.height;
if(k>=1)
{
if (obj.width>=100)
{
obj.width=100;
obj.height=obj.width/k;
}
}
else
{
if (obj.height>=100)
{
obj.height=100;
obj.width=k*obj.height;
}
}
}
</script>
<img border=0 ID=smallslot src=test.jpg align="absbottom" onmousewheel="return bbimg(this)" οnlοad=show(this)>