不写alert呗,改成把页面上某个元素的内容填充为你的提示信息

解决方案 »

  1.   

    不用alert()进行弹出,用层来显示,把层的z-index设置在文本框的下方,当不符合条件的时候,先把div的位置设置为文本框的位置,然后弹出div,并且在弹出的时候改变他的高度和宽度,明白~~
      

  2.   


    window.onclick=function(){
       var wind=document.createElement("div");
       var mes=document.createElement("div");
       mes.innerHTML="你有新消息";
       var link=document.createElement("a");
       link.href="#";
       link.onclick=function(){history.go(1);return false;};//你可忽略。
       link.innerHTML="知道了";
       wind.appendChild(mes);
       wind.appendChild(link); 
       wind.style.cssText="position:absolute;top:100px;left:100px; background-color:yellow;border:1px solid yellow;z-index:99;width:150px;height:150px;";
       document.body.appendChild(wind);
    }方法类似于上。。