SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Error Reporting and JavaScript

  1. #1
    SitePoint Evangelist Fergal's Avatar
    Join Date
    Nov 2003
    Location
    Ireland
    Posts
    482
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Error Reporting and JavaScript

    I've just started learning a little JavaScript. When I make an error in my code all I see is a blank page in my browser.

    Is there any way to turn on error reporting, so that I can see where my coding errors are?

    Thanks!
    Fergal Crawley (Previous Username: Proudirish.com)
    Business Advice Forum - Webmaster and Business Forum < Get a free link & win $5,000
    Forum Promotion

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    15,823
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Just open the error console - that's where the error messages get displayed. See http://javascriptexample.net/basics98.php for instructions on where to find it in various different browsers.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    Grüße aus'm Pott
    SitePoint Award Recipient Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    2,478
    Mentioned
    40 Post(s)
    Tagged
    2 Thread(s)
    To add to what felgal says, I wrote a short blog post about this - maybe it helps: Simple JavaScript debugging with Chrome’s console

    Edit: A more advanced video tutorial: http://www.youtube.com/watch?feature...v=N8SS-rUEZPg#!
    How well do you know your JavaScript from your jQuery?
    Check out SitePoint's latest JavaScript challenge


    My blog

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    15,823
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Pullo View Post
    I wrote a short blog post about this - maybe it helps: Simple JavaScript debugging with Chrome’s console!
    Nice tutorial with a clear explanation of how the console works.

    The one thing you left out in the mention of alert() as a not so good alternative is that Chrome, Safari and Firefox will display a checkbox on the second and subsequent times the alert appears so that you can skip the rest of the alerts and Opera displays an extra checkbox every time allowing you to turn off JavaScript for the page. So if you figure out the problem on the first or second alert you can skip the rest. Not as convenient as using the console though.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  5. #5
    Grüße aus'm Pott
    SitePoint Award Recipient Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    2,478
    Mentioned
    40 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by felgall View Post
    Nice tutorial with a clear explanation of how the console works.
    Thank you Stephen, I appreciate that!!

    I have updated the tutorial to include your comments.
    I also added a link to your homepage by way of a thank you for the feedback.
    How well do you know your JavaScript from your jQuery?
    Check out SitePoint's latest JavaScript challenge


    My blog

Bookmarks

Posting Permissions

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