Home >Web Front-end >JS Tutorial >JavaScript skills_Dragable window, with mouse control of gradient transparency, open and close functions
<script><br><!--<br/>// code by windy_sk<br/>var timer=null;<br/>var org_opacity=30;<br/>var step=5;<br/>var ext_time=30;</p><p>function doit(img,mode){<br/> clearTimeout(timer);<br/> if(img.style.filter.indexOf("alpha")==-1)img.style.filter ="alpha(opacity=" org_opacity ")";<br/> var cur_level=img.filters.alpha.opacity;<br/> if(mode){<br/> cur_level =step;<br/> if(cur_level>100)cur_level=100;<br> }else{<br> cur_level-=step;<br> if(cur_level<org_opacity)cur_level=org_opacity;<br/> }<br/> img.filters.alpha.opacity=cur_level;<br/> if(cur_level!=100 && cur_level!==ext_time)<br/> timer=setTimeout("doit(" img.id "," mode ")",ext_time)<br/>}</p><p>function MM_showHideLayers() { //v6.0<br/> var i,p,v,obj,args=MM_showHideLayers.arguments;<br/> for (i=0; i<(args.length-2); i =3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i 2];<br/> if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }<br/> obj.visibility=v; }<br/>}<br/>//--><br></script>