相对来说可以让初学者看一下,并不太实用,可能jquery4条语句就能解决,但是原生相对有参照性,了解最终原理才是关键。 复制代码 代码如下: 无标题文档 <BR>body {margin:0;padding:0;color:#000000;} <BR>#div_test { <BR>width: 100%; <BR>height: 100%; <BR>background-color: #000000; <BR>position:absolute; <BR>filter:Alpha(Opacity=0) <BR>} <BR> <BR>var i = 100; <BR>function $(id) {return document.getElementById(id);} <BR>function chang_display() { i--; <BR>var div = $('div_test'); <BR>div.style.filter = "Alpha(Opacity="+i+")"; <BR>div.style.opacity = i / 100; <BR>if ( i== "0") <BR>{document.getElementById('div_test').style.display="none";//隐藏 <BR>exit <BR>} <br><br>} <BR>/*控制div隐藏*/ <BR>function hid() { <BR>setInterval(chang_display, 1); <BR>} <br><br> 123123123 <BR>var j = 0; <BR>function $(id) {return document.getElementById(id);} <BR>function turn_display() <BR>{ j++; <BR>var div = $('div_test'); <BR>div.style.filter = "Alpha(Opacity="+j+")"; <BR>div.style.opacity = j / 100; <BR>if ( j== "0") <BR>{document.getElementById('div_test').style.display="none";//隐藏 <BR>exit <BR>} <BR>} <BR>setInterval(turn_display, 1); <BR>