alert是系统标准对话框,字体改不了
要想做出效果只能自己做个页面文件然后用showModalDialog打开

解决方案 »

  1.   

    a.htm<script language="JavaScript">
    <!--
    /*@cc_on @*/
    /*@if (@_win32 && @_jscript_version>=5)
    function window.alert(strText){
    var pWin=window.showModalDialog("b.htm",strText,"dialogHeight:116px; dialogWidth:232px; help: No; resizable: no; status: No; scroll:no; dialogTop:"+(screen.height-116)/2+"px; dialogLeft:"+(screen.width-232)/2+"px;");
    }
    @end @*/
    var i=0;
    alert("用户名非法!"+i++);
    alert("用户名非法!"+i++);
    alert("用户名非法!"+i++);
    alert("用户名非法!"+i++);
    alert("用户名非法!"+i++);
    //-->
    </script>
    b.htm
    <html>
    <head>
    <style type="text/css">
    body{ }
    td,input{ font-size:12px}
    </style>
    <script language="JavaScript">
    <!--
    var str  =  window.dialogArguments;
    function doOk(){
    window.returnValue="";
    window.close();
    }
    function setTimer(){
    window.setTimeout("document.getElementById('btnOk').click()",1500);
    }
    document.onclick=function (){
    document.getElementById("btnOk").focus();
    }
    document.oncontextmenu=function (){
    document.getElementById("btnOk").focus();
    }
    //-->
    </script>
    <title>提示信息&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</title>
    </head>
    <body style="background-color:buttonface; margin:0" onload="setTimer()">
    <table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
    <tr height="65%">
    <td width="25%" align="center" valign="center"><img src="warning.gif" style="width:32px; height:32px"></td>
    <td valign="middle">
    <script language="JavaScript">
    <!--
    document.write(str);
    //-->
    </script>
    </td>
    </tr>
    <tr height="35%">
    <td colspan="2" align="center" valign="top">
    <input type="button" id="btnOk" value="  确定  " onclick="doOk()">
    </td>
    </tr>
    </table>
    </body>
    <html>图片可以在windows系统中找到