Home  >  Article  >  Web Front-end  >  js calls image hiding & display implementation code_javascript skills

js calls image hiding & display implementation code_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:22:431260browse
复制代码 代码如下:





<SCRIPT> <br>var intTimeStep=20; <br>var isIe=(window.ActiveXObject)?true:false; <br>var intAlphaStep=(isIe)?5:0.05; <br>var curSObj=null; <br>var curOpacity=null; <br>function startObjVisible(objId) <br>{ <br>curSObj=document.getElementById(objId); <br>setObjState(); <br>} <br>function setObjState(evTarget) <br>{ <br>if (curSObj.style.display==""){curOpacity=1;setObjClose();} <br>else{ <br>if(isIe) <br>{ <br>curSObj.style.cssText='DISPLAY: none;Z-INDEX: 1; FILTER: alpha(opacity=0); POSITION: absolute;'; <br>curSObj.filters.alpha.opacity=0; <br>}else <br>{ <br>curSObj.style.opacity=0 <br>} <br>curSObj.style.display=''; <br>curOpacity=0; <br>setObjOpen(); <br>} <br>} <br>function setObjOpen() <br>{ <br>if(isIe) <br>{ <br>curSObj.filters.alpha.opacity =intAlphaStep; <br>if (curSObj.filters.alpha.opacity<100) setTimeout('setObjOpen()',intTimeStep); <BR>}else{ <BR>curOpacity =intAlphaStep; <BR>curSObj.style.opacity =curOpacity; <BR>if (curOpacity<1) setTimeout('setObjOpen()',intTimeStep); <BR>} <BR>} <BR>function setObjClose() <BR>{ <BR>if(isIe) <BR>{ <BR>curSObj.filters.alpha.opacity-=intAlphaStep; <BR>if (curSObj.filters.alpha.opacity>0) { <br>setTimeout('setObjClose()',intTimeStep);} <br>else {curSObj.style.display="none";} <br>}else{ <br>curOpacity-=intAlphaStep; <br>if (curOpacity>0) { <br>curSObj.style.opacity =curOpacity; <br>setTimeout('setObjClose()',intTimeStep);} <br>else {curSObj.style.display='none';} <br>} <br>} <br></SCRIPT>








Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn