Show console errors or information on the page - Javascript DOM

Javascript examples for DOM:Element innerHTML

Description

Show console errors or information on the page

Demo Code

ResultView the demo in separate window

<html>
   <head></head>
   <body> 
      <input type="button" value="INCREMENT" onClick="INCREMENT()"> 
      <input type="button" value="DECREMENT" onClick="DECREMENT()"> 
      <div id="E"></div> 
      <script>
window.onerror = function(e){//from ww w.  j  a  v a 2 s. com
  document.getElementById('E').innerHTML = e.toString();
}

      </script>  
   </body>
</html>

Related Tutorials