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

JavaScript error handling help - please!!?

  • Write JS code that anticipates and handles an error for an expected numeric field. This code is executed on keypress, and the entered value is saved for you in a variable called enteredChar. Include the try block of JS statements needed to check if the character is not a number or a non-alphanumeric character, or if you throw an error message. <script type="text/javascript"> function validateNumber(formObject) { var x=prompt("0",""); try { if(x>10) { throw "er1"; } else if(x<0) { throw "er2"; } else if(isNaN(x)) { throw "er3"; } } catch(er) { if(er=="er1") { alert("Error: The value is too high"); } if(er=="er2") { alert("Error: The value is too low"); } if(er=="er3") { alert("Error: The value is invalid"); } } </script> would that work for that? and then I do no understand this Write a custom error handling JS function called processErrors that handles a custom error by assigning it to the onerror event handler. Include the block of JS statements needed to pass the arguments sent by the JS interpreter into the processErrors function, send an alert message with the agreements, return, and write the event handler that calls the processErrors function.

  • Answer:

    Try adding new variables and see if that helps.

Darian 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.