开发者

JavaScript Error Coding

开发者 https://www.devze.com 2023-01-27 11:23 出处:网络
I am having some issues with my homework assignment. I don\'t know how to start it or how to do it. I don\'t need the entire code just what is needed for what is being asked. Please can anyone help me

I am having some issues with my homework assignment. I don't know how to start it or how to do it. I don't need the entire code just what is needed for what is being asked. Please can anyone help me on this. I need it ASAP.

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 aler开发者_StackOverflow社区t message with the agreements, return, and write the event handler that calls the processErrors function.

Please can anyone help me.

function handler (processErrors); { onerror="alert ('There was a custom error')"}


This type of stuff can be a bit challenging when you are completely new to it, so Ill help. In an html page, put something like the following

<script>
  function handler(event) { 
     alert(event);
  }
</script>

note that example is not complete according to your question. what this does is declare a js function, 'handler', that takes an argument, 'event', and then pops up the event. This is done is 'script' tags, which you should also expand according to your research.

The next thing you will have to do is assign the function defined above that you complete, to the onerror event of some dom, as shown here: http://www.w3schools.com/jsref/event_onerror.asp

Look here for more guidance on js.

http://www.w3schools.com/js/default.asp

You also might want to google things like: "html script tags" and "javascript event handlers"

0

精彩评论

暂无评论...
验证码 换一张
取 消