...
catch(Exception ex)
{
Response.Write(@ " <script> javascript:alert( 'System is wrong,wrong is ' "+ex.Message+ " '! ') </script> ");
}
在上面代碼中,Response.Write(@ " <script> javascript:alert( 'System is wrong,wrong is "+ex.Message+ "! ') </script> ");寫得不行,會出錯,請問怎樣用javascript的alert拋出詳細異常ex.Message?
謝謝!
------解决方案--------------------------------------------------------
如果还不行。string errMsg= "System is wrong,it is "+ex.Message;errMsg = errMsg.Replace( "\r\n ", "\\r\\n ");errMsg = errMsg.Replace( " ' ", "\\ ' ");