SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Aug 2007
    Posts
    328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Is there a quick way to check for mistakes?

    Hi,
    I've been working from a book to create a small javascript image gallery.
    I was going through it and everything was fine, I advanced a bit and then it wasn't working anymore.

    I compared what I had done directly to what was in the book and it looked exactly the same. I'm fairly sure that I must have messed it up somewhere, but my non-javascript eyes couldn't pick it up.

    I'm using dreamweaver. Is there any way at all to see if you've messed up your code, such as warnings or highlights etc.

    The problem is, when the script doesn't work, it JUST doesn't work, it doesn't show error messages or anything at all, it just doesn't work.
    Is there also a way to turn on error messages like in php for example?
    So I'll be able to see exactly what I've messed up.

    regards
    steve

  2. #2
    SitePoint Member RIAguy's Avatar
    Join Date
    Jul 2008
    Location
    Boston
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I thought DreamWeaver has a JavaScript debugger?

    Top two JavaScript Debugging tips

    -Test using Firebug - I like to open Firebug in a separate window

    -You can take your code over to jslint.com and look for JavaScript errors. Be careful because the guy who wrote the tool has some strong opinions about what makes "good" javaScript - but it will help you find errors.


    RIAspot.com

    RIA Community

  3. #3
    SitePoint Addict
    Join Date
    Aug 2007
    Posts
    328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    thanks for the reply.

    I took a look a jslint.com and I'm a little confused by what I saw when I copied and pasted in the javascript. The script works, but it's throwing up all kinds of problems that it's found. How can I tell which part is braking my scripts?

    I'm a bit confused about firebug too.
    My script is in an external file, will firebug only work properly if it's embeded in the page for testing purposes or something?

    The reason I ask is that I changed:
    if (!document.getElementById("placeholder")) return true;

    Which is valid code as far as I know. To:
    if (!document.getElementXXXById("placeholder")) return true;

    It didn't complain at all or show any problems, even though just that little bit completely broke the script.

    regards
    steve

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    If you're running the web page in Firefox then you can always go to the Tools menu and open the Error Console to find out what's going wrong.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


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
  •