Real-time error code processing
The JavaScript code we compile sometimes has some errors due to our negligence, so that users
The annoying error prompt framework will pop up during browsing. How can this problem be solved? Which of the following statements about the community? Nbsp;
See method:
(1) completely fault tolerant
That is, all errors are ignored when you browse pages with error code. The Code is as follows:
<Script> 〉
Function killerr (){
Return true
}
Window. onerror = killerr
</Script> 〉
Although it can cover up errors and avoid pop-up error prompts, but the program is still not correctly executed, the following introduces another
Processing Method.
(2) feedback error information
That is, when the error code appears, the pre-designed feedback window is automatically displayed, so that users only need
Click the mouse to send the feedback to your specified mailbox.
You can modify the design as needed. The Code is as follows:
<Script> 〉
Function errorinfo ()
{
Errorwin = window. open ("", "", "width = 20, height = 120 ″)
Errorwin.doc ument. write ('<title> Script Error Report </title> <center> feedom.net
A script running error was found, please <a href = "mailto: lhy@cenpok.net"> notice </a> 〉
Administrator. <Br> <form> <input type = "button" value = "Close Window" onCli
Ck = "window. close ()"> </form> </center> 〉′)
Errorwin.doc ument. close ()
Errorwin.doc ument. bgColor = "# ffffff ″
Return true
}
Window. onerror = errorinfo
</Script> [transferred from www.bitsCN.com]