如何让图片以固定尺寸加载 <img> 本身就有width,heigth的属性的。为什么舍近求远,用js呢。你用JS的话,肯定会看到图片缩小的过程的。图片越大,越明显。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>JK:支持民族工业,尽量少买X货</title><script>function setMaxHeight(imgObj,maxHeight){ if(imgObj.offsetHeight>maxHeight) { imgObj.height=maxHeight; imgObj.removeAttribute('width'); }}</script></head><body><div style="font-size:10pt;">注1:设定图片的最大宽度或高度,同时保证图片比例。 <br/> <br/> 注:本页面仅在IE6/FireFox1.5下测试过。其它浏览器或其它版本未经测试。<br/> 注-----:JK:<a href="mailTo:[email protected]?subject=About IMG">[email protected]</a><br/> <hr/> </div><IMG id="big_img2"src="20060925132517e9cb7.gif" width="200" onload="setMaxHeight(this,300);"></body></html> 搂主,可以这么做!<img alt="点击看大图" src="1.jpg" style="overflow:hidden;width:200px;height:200px;" onload="DrawImage(this,200,200);" /> 这样就不会因为加载的时候看见页面临时变大了! FusionCharts中如何让滚动条出现在纵坐标? 检测浏览器是否安装Adobe SVG Viewer 的js代码 Jquery制作导航菜单的问题 settimeout有属性吗? 如何让这样的东西左右对齐 ff看下效果 ie下也看下 关于利用webbrowser进行打印时的也眉页脚控制问题,各位请多多赐教 如何实现同一表单按时多次提交 opener是什么? 难题:怎样用window.open(...)来模拟showModaldialog的功能?即在不关闭用open打开的页下使用户单击页面无效。 菜鸟的问题:怎么在后台播放声音? 求一个简单的js脚本 改变图像的问题。
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>JK:支持民族工业,尽量少买X货</title>
<script>
function setMaxHeight(imgObj,maxHeight){
if(imgObj.offsetHeight>maxHeight) {
imgObj.height=maxHeight;
imgObj.removeAttribute('width');
}
}
</script>
</head>
<body>
<div style="font-size:10pt;">
注1:设定图片的最大宽度或高度,同时保证图片比例。 <br/> <br/>
注:本页面仅在IE6/FireFox1.5下测试过。其它浏览器或其它版本未经测试。<br/>
注-----:JK:<a href="mailTo:[email protected]?subject=About IMG">[email protected]</a><br/>
<hr/>
</div><IMG id="big_img2"
src="20060925132517e9cb7.gif" width="200" onload="setMaxHeight(this,300);">
</body>
</html>