点击按纽以后,在本身页面出现Label控件里 修改成功 或 修改失败的 提示,在5秒以后提示信息小时

解决方案 »

  1.   

    <html>
    <head><script language=javascript>
    function a(){
    var o=document.getElementById("tip");
    //可以在这里写验证是否成功
    o.innerHTML="提交成功";
    setTimeout("b()",5000);
    }

    function b(){

    var o=document.getElementById("tip");
    o.innerHTML="";
    }
    </script>
    </head>
    <body >
    <input type=button value="submit" onclick="a();">
    <div id="tip"></div>
    </body>
    </html>
      

  2.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <script language="javascript">
    function ShowMsg(){
    var oLabel=document.getElementById("labMsg");
    oLabel.innerHTML="<font color=red>提交成功!</font>";
    oLabel.style.display="block";
    window.setTimeout('HideMsg()',5000);
    }

    function HideMsg(){
    var oLabel=document.getElementById("labMsg");
    oLabel.style.display="none"; }
    </script>
    </head>
    <body>
    <label id="labMsg" style="display:none"></label>
    <input name="btnok" type="button" id="btnok" value="确定" onclick="ShowMsg()"/>
    </body>
    </html>