原页面文件:
<script language="Javascript">
<!--function fnOpenModal(String){
    window.showModalDialog("error.htm",String,"status:off;help:off;dialogWidth:413px;dialogHeight:192px"); 
}function check()
{
    if (pMform.mc.value=="") {fnOpenModal("请输入一些文字!")}
    return true;
}
//-->
</script>
<form name="pMform">
名称:<input type="text" name="mc" class="input_1" size="15">
<input type="submit" name="Submit2" value="确定" class="Button2" onclick='return check()'> 
</form>error.htm:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>发生错误</title>
</head>
<body style="border:1 solid #CCCCCC; background-color:#EEEEEE;color:red;font-size:12px;height:100%;text-align:center;overflow:hidden;">
<script language="javascript">
function window.onload()
{
if(window.dialogArguments)
Msg.innerText = window.dialogArguments;
}
</script>
<table><tr><td></td></tr></table>
<div id="Msg">
</div></body>
</html>

解决方案 »

  1.   

    谢谢你GageCSDN(稻草人);又是你帮我解决问题了!
      

  2.   

    在error.htm中
    <script language="javascript">
    var srcc = window.location;
    srcc = srcc.toString()
    start = srcc.indexOf("?");
    end = srcc.length;
    if (start==-1)
     {
       srcc = "未知错误!"
     }
    document.write(srcc);
    </script>
    让后你就可以用.../error.htm?错误提示字符串
      

  3.   

    主页面
    <html><head>
    <title></title>
    <script language="Javascript">
    <!--function fnOpenModal(){
        window.showModalDialog("error.jsp?deptname=123",window,"status:off;help:off;dialogWidth:413px;dialogHeight:192px"); 
    }function check()
    {
        if (pMform.mc.value=="") {fnOpenModal()}
        return true;
    }
    //-->
    </script>
    </head><body>
    <form name="pMform">
    <INPUT type="hidden" name="deptname" size="21" value="12345">
    name<input type="text" name="mc" size="15">
    <input type="submit" name="Submit2" value="Submit" class="Button2" onclick='return check()'>
    </form>
    </body>
    </html>
    error.jsp
    <html><head>
    <title>fsafdsdfsdfa</title>
    </head><body>
    <%= request.getParameter("deptname")%>
    </body></html>
      

  4.   

    if (start!=-1){
    srcc = srcc.substring(start+1,end);
    }
    漏了一点
    document.write(srcc);前