DiLDoG
01-14-2003, 09:07 AM
How do I hide error messages?
|
Click to See Complete Forum and Search --> : Hide errors DiLDoG 01-14-2003, 09:07 AM How do I hide error messages? swon 01-14-2003, 11:39 AM In javascript? No chance! pyro 01-14-2003, 11:58 AM Actually you can...Add this to your <head> <script type="text/javascript"> function handleError() { return true; } window.onerror = handleError; </script> DiLDoG 01-14-2003, 12:02 PM wow thnx dude!!! U really helped me out Uhm is it possible to to print the type of error and were it occured @ the end of the page? pyro 01-14-2003, 01:01 PM Here you go! A custom error handler. Just put the <div> where you want your error message to appear. <html> <head> <style type="text/css"> .error { background-color: #cfcfcf; border: 1 px; border-style: solid; border-color: black; font-size: 8pt; font-family: Arial; padding-left: 2px; } </style> <script type="text/javascript"> window.onerror=handleError; function handleError(msg,url,line) { errorlog.innerHTML+="Error: " + msg + "<br>"; errorlog.innerHTML+="Line: " + line + "<br>"; errorlog.innerHTML+="URL: " + url + "<br>"; return true; } </script> </head> <body> <div id="errorlog" class="error"></div> </body> </html> swon 01-14-2003, 01:26 PM :cool: Great, didn't know that! pyro 01-14-2003, 01:46 PM :D lol. One thing to keep in mind. This doesn't report all errors. (I've got no idea why) For instance if you do this document.write ("test" It should tell you that you forgot your closing ) but it doesn't. If you use the browsers error handler, however, it will. Hmm.... swon 01-14-2003, 02:04 PM :confused: , but that's not important enough to get your brain smoking! pyro 01-14-2003, 02:17 PM Nope. :) webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |