Finding the Errors on Your Site

    July 28, 2003

When you are building your site, and try to test it in a browser, do you sometimes (or perhaps more often) get an error message telling you that your site contains a script error, and would you like to continue running scripts on the page – yes or no?

If so, look at that screen before discounting it – it should tell you which line has a syntax error or whatever problem it tells you. You can now look for that line to correct it – but finding it might not be as easy as you’d think. Blank lines do count, and the count might piece some lines together which you would no expect. One way to find the line in question is to go near the line you think you counted to.

When you are there, see which line it tells you the error is at. For example, if your error is at line 33, you can go to about line 29 and then add a blank line. Again try to view the page – which line does it tell you the error is on now? Does it say line 33 again? If so, you have added the blank line AFTER the line with an error. Go up about 5 lines and try it. If it said line 34, then the line with the error is after the blank line. Sneak up on it by taking out the blank line and moving up a couple lines. Try it again. If it now says line 33, you know you just passed the line with the error. Look at the couple of lines you moved through. If it says line 34 had the error – move up a couple more lines and try again. You might not pinpoint the EXACT line, but you will get within 2-3 of it – look at it carefully and find the error in it. It can be a ” where it should be ‘ – or an incomplete code that didn’t close (no ) or a misspelling of a code – any number of things. Try making changes to it and see if that makes a difference in taking out your error message.

Now you can clean up your site, once you have found the lines with the errors. If you are fortunate enough to have a good HTML editor that will count out lines, then you need not hunt for them, but this is a good trick to try if you don’t get an accurate line count.

P. Roe does website optimization work, and is working on her sites all the time – many are in number 1-10 ranking on Google and Yahoo! Subscribe to “Wise Little Tidbits” for more optimization tips.