无聊,写了一个图片后加载的东东,感谢asfman帮忙
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN"><head><meta http-equiv="content-type" content="text/html; charset=gb2312" /><meta http-equiv="content-language" content="zh-CN" /><meta http-equiv="pragma" content="no-cache" /><meta http-equiv="expires" content="0" /><meta http-equiv="MSThemeCompatible" content="Yes" /><meta http-equiv="imagetoolbar" content="no" /> <meta http-equiv="widow-target" content="_top" /><meta name="robots" content="index, follow" /><meta name="author" content="3945, [email]ljm77@km169.net[/email]" /> <meta name="keywords" content="" /><meta name="description" content="" /><meta name="copyright" content="Copyright 3945 All Rights Reserved" /> <title>无标题文档</title> <style type="text/css"><!-- a, a:link{text-decoration: none; color:#000000; font-size:9pt;} a:visited{text-decoration: none; color:#000000;} a:hover{text-decoration: underline; color:red;} body, td, p, li, div, select{font-size:9pt; font-family:"宋体";} img{border:0;} --></style> <script type="text/javascript"> /*图片后加载处理 运行*/ function runImgs() { var o=null,d=null,s=null,l=document.images.length; for(var i=0; i<l; i++) { o=document.images[i]; if(d=o.getAttribute('summary')) { s=eval('('+d+')'); if(s.w<=0) { window.setTimeout(function(o,s){ return function(){ var img=new Image(); img.onerror=function(){with(o){setAttribute('width','100'),setAttribute('height','100'),setAttribute('src',this.src)}}; img.onload=function() { var iw=this.width; var ih=this.height; var mx=(0-s.w); iw=iw>0?iw:80; iw=s.w<0?(iw>mx?mx:iw):iw; o.setAttribute('src',this.src); o.setAttribute('width',iw); }; img.setAttribute('src',s.u); }; }(o,s),1); } else with(o){setAttribute('src',s.u),setAttribute('width',s.w),setAttribute('height',s.h)}; //指定大小 s=null; } o=d=null; } } window.onload=function(){ runImgs(); } </script> </head> <body> <img src="about:blank" width="0" summary="{u:'http://www.aspxhome.com/images/logo.gif',w:146,h:95}" /> <!-- 指定大小 --> <img src="about:blank" width="0" summary="{u:'http://www.aspxhome.com/images/logo.gif',w:0}" /> <!-- 原始大小(图片原大小) --> <img src="about:blank" width="0" summary="{u:'http://www.aspxhome.com/images/logo.gif',w:-50}" /> <!-- 指定最大值 --> <img src="about:blank" width="0" summary="{u:'http://www.aspxhome.com/images/logo.gif',w:-250}" /> <!-- 指定最大值 --> </body> </html> [提示:你可先修改部分代码,再按运行]