<script language="javascript">
setTimeout("document.getElementById('flash').style.display='none'",5000) //因为延迟,由8秒改成13秒
setTimeout("document.getElementById('flash').style.display=''",10);
</script>这是我从网上搜到的一段代码,用于弹出flash后5秒后自动消失,但我随上面这段代码不是很懂,这段代码是什么意思啊?怎么会将style.display=''?这段代码的用意是什么啊?能不能去掉?
setTimeout("document.getElementById('flash').style.display='none'",5000) //因为延迟,由8秒改成13秒
setTimeout("document.getElementById('flash').style.display=''",10);
</script>这是我从网上搜到的一段代码,用于弹出flash后5秒后自动消失,但我随上面这段代码不是很懂,这段代码是什么意思啊?怎么会将style.display=''?这段代码的用意是什么啊?能不能去掉?
style.display=''
改为
style.display='inline'设置为空字符串写法的实际效果是设置为缺省值"inline",
但属于垃圾写法、可读性极差,还是写清楚好些!
<script type="text/javascript" defer>
<!--
document.getElementById('flash').style.display = 'inline';
setTimeout("document.getElementById('flash').style.display = 'none'", 5000) // 5秒后消失。
//-->
</script>
block 显示
style.display='' 跟style.display="block"都是现实该元素,但是在不同的浏览器中还是有区别的。
所以一般用style.display=''
http://download.csdn.net/source/308916DHTML参考手册.rar
http://download.csdn.net/source/308913样式表中文手册.chm
http://download.csdn.net/source/304124
这一句删除之后还是能够实现自动消失呢?
能不能去掉?这一行是必须的嘛?