交互设计中心-72色

交互设计中心 | 用户体验 | 优化

图片缩略图,点击放大到原图大小

2008年2月5日 | 分类:jquery/javascript | 评论:0 | 引用:0 | 浏览: | Tags:javascript  js  

 

<script language="javascript"> 
  var saveWidth = 0; 
 function scaleImg(what) 
 { 
  what = document.getElementById(what); 
   if (navigator.appName=="Netscape") 
  winW = window.innerWidth; 
  if (navigator.appName.indexOf("Microsoft")!=-1) 
   winW = document.body.offsetWidth; 
  if (what.width>(300) || saveWidth>(300)) { 
   if (what.width==(300)) 
     what.width=saveWidth; 
   else 
   { 
    saveWidth = what.width; 
    what.style.cursor = "pointer"; 
    what.width=(300); 
   } 
  } 
 } 
</script> 
<img src="http://www.72color.com/UPLOAD/w3c.gif" id="IMG1" onClick="javascript:scaleImg('IMG1')" onLoad="javascript:scaleImg

('IMG1')" />


Share
« (转)几款漂亮的DIV+CSS+(JS)打造的相册无图片实现圆角框---纯css »



◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。