Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,187
    Thanks
    15
    Thanked 253 Times in 253 Posts

    Two very useful things for javascript coders.

    Code:
    <script type="text/javascript">
    
    //Alerts to errors.
    
    window.onerror=function(msg, url, linenumber){var logerror='Error message: ' + msg + '. Url: ' + url + 'Line Number: ' + linenumber;alert(logerror);return false}
    
    </script>
    I put that block of code in all my page templates, it tells me where and often what a problem is. It has saved many an hour of troubleshooting because it lets me know right away.

    The second important thing is what Firefox can do for you. It's the only browser I know of that lets you see the page that is generated by javascript. Open this page with Firefox:

    http://ronbeau.50webs.com/utilities/escape-codes.html

    Then go : View, Page Source and take a look.

    Then right click on the body of the page and choose Select All, then right click again and choose View Selection Source. You can just click on the selection source to see the written code better. What a difference! I think you can see what a useful tool this is in reviewing and troubleshooting your code.

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Great! You have re-discovered the wheel:

    http://www.w3schools.com/jsref/event_onerror.asp
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •