How to pass a parameter to a function that is called on an event?

Simple JavaScript help?

  • Write a custom error handling JavaScript function called processErrors that handles a custom error by assigning it to the onerror event handler. Include the block of JavaScript statements needed to pass the arguments sent by the JavaScript interpreter into the processErrors function, send an alert message with the agreements, return, and write the event handler that calls the processErrors function. This is what I came up with so far onerror=processErrors function handleErr() { //Handle the error here return true }

  • Answer:

    <script type="text/javascript"> var errordialog=function(msg){ alert(err); return true } window.onerror=function(msg, url, linenumber){ var msg='errordialog'; msg +=' <b style="color:red">JavaScript Error: </b>' + msg +' at line number ' + linenumber; return errordialog(msg) } if you use try catch try { } catch (ex){ errordialog('error at this try catch block' + ex.description); } </script>

Brittney at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.