[Javascript] window.onerror()

Andrew Gibson andyg at ihug.co.nz
Tue Feb 11 18:04:02 CST 2003


Thanks Peter, mistake I made was to not put a return true in the custom
error function! I'd like to find a way of sending the function name in the
error message now!

<script>
function tellerror(err){
alert(err)
 return true;  // here!
}
window.onerror=tellerror
</script>

<script>
document.write('hi there)  // deliberate error
</script>
</head>


> Andrew,
>
> For some reason, the event handlers want you to use parentheses, i.e.
>
> window.onerror=tellerror();
>
> Regards,
>
> Peter
>
> |-----Original Message-----
> |From: javascript-admin at LaTech.edu [mailto:javascript-admin at LaTech.edu]On
> |Behalf Of Andrew Gibson
> |Sent: Tuesday, February 11, 2003 5:23 PM
> |To: javascript at LaTech.edu
> |Subject: [Javascript] window.onerror()
> |
> |
> |I'm trying to implement window.onerror on a i.e 6  page.
> |
> |I grabbed this code from a tutorial page, but when I paste the code, it
> |simply suppresses the error and doesn't perform the function
> |tellerror which
> |is what happens on their page as well at
> | http://www.javascriptkit.com/javatutors/error2.shtml
> |
> |Is this something to do with ie 6.0,. and if so, is there a workaround to
> |process client javascript errors?
> |
> |Cheers
> |Andrew
> |
> |<head>
> |<title>New Page 2</title>
> |<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
> |<script>
> |function tellerror(){
> |alert('An error has occured!')
> |}
> |window.onerror=tellerror
> |</script>
> |
> |<script>
> |document.write('hi there)  // deliberate error
> |</script>
> |</head>
> |
> |
> |_______________________________________________
> |Javascript mailing list
> |Javascript at LaTech.edu
> |https://lists.LaTech.edu/mailman/listinfo/javascript
> |
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>





More information about the Javascript mailing list