// 方法:setselectreadonly 用于设定极select控件readonly,
// 这个一个模拟只读不是真的只读
// 使用了onbeforeactivate,onfocus,onmouseover,onmouseout事件
// 示例:< img src='img.jpg' onload='imgautosize(imgd,fitwidth,fitheight)' > ;
// create by sl
// ---------------------------------------------------
function imgautosize(imgd,fitwidth,fitheight)
{
var image1=new image();
image1.onload = function ()
{
if(this.width>0 && this.height>0)
{
if(this.width/this.height>= fitwidth/fitheight)
{
if(this.width>fitwidth)
{
imgd.width=fitwidth;
imgd.height=(this.height*fitwidth)/this.width;
}
else
{
imgd.width=this.width;
imgd.height=this.height;
}
}
else
{
if(this.height>fitheight)
{
imgd.height=fitheight;
imgd.width=(this.width*fitheight)/this.height;
}
else
{
imgd.width=this.width;
imgd.height=this.height;
}
}
}
image1 = null;
}
image1.src=imgd.src;
imgd.style.cursor = 'hand';
imgd.onclick= function(){openwin(this.src,'imgphoto',600,400)};
imgd.title = "点击在新窗口中查看原图";
}