<div class="codetitle"> <span><a style="CURSOR: pointer" data="20324" class="copybut" id="copybut20324" onclick="doCopy('code20324')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code20324"> <br> <br> <br> <br><br><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> <br> <br><br><br><input type="text" onclick="startObjVisible('objDiv');if(this.value==''){this.value=''}else{this.value=''}" value=""> <br><div id="objDiv" style="DISPLAY: none;"><img src="%E7%BA%A2%E8%83%8C%E5%BF%83%E5%B9%B3%E5%8F%B0/images/%E5%9F%8E%E5%B8%82.jpg" alt="js调用图片隐藏&显示实现代码_javascript技巧" ></div> <br><br> <br> <br> </div>