日期:2014-05-16  浏览次数:20429 次

自动消失的消息提示(Js+Div实现)
var closetime;
2
3function showmsg(msg,showtime)
4{
5    var md=document.getElementById("msgdiv");
6    md.innerHTML =" "+msg+" ";
7    md.visibility = "visible";
8    if(closetime)window.clearTimeout(closetime);
9    closetime=setTimeout(hiddenmsg,showtime*1000);   
10}
11
12function hiddenmsg()
13{
14    var md=document.getElementById("msgdiv");
15    md.innerHTML = "";
16    md.visibility = "hidden";
17}