locating errors in scripts... i.e. line "123"
O.k., this may be a stupid question but it is time I found out how to track down errors in scripts.
My question is: when an error appears on a page it usually says... error on line "xxx". How do you find line "xxx" ? other than counting down lines????
timjpriebe posted this at 16:33 — 11th May 2007.
He has: 2,667 posts
Joined: Dec 2004
Use an editor that displays line numbers next to the lines.
For Windows, ScITE is one such editor.
teammatt3 posted this at 18:33 — 11th May 2007.
He has: 2,102 posts
Joined: Sep 2003
Are you using notepad? Just hit ctrl g and type in the line number. Make sure word wrap is turned off, or it won't work.
Megan posted this at 18:47 — 11th May 2007.
She has: 11,421 posts
Joined: Jun 1999
You may also be able to use the web developer extension for whichever browser you are using, or change your default source viewer to something that shows line numbers. I've found this helpful when the generated source is different from the original source. Then you can use the toolbar extension to view the generated source and check for the right line number.
Your HTML editor may not show the line numbers by default - look for an option to turn them on. Most editors should have this option available.
Megan
Connect with us on Facebook!
webwiz posted this at 04:04 — 12th May 2007.
He has: 629 posts
Joined: May 2007
Opera and Firefox have error consoles that display meaningful error messages caused by both JavaScript and CSS errors. Tools > Error Console in FF2; Tools > Advanced > Error Console in Opera.
IE does have a debugger, but I found it hard to use.
Did you know about Firebug?
Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;
cbc58 posted this at 12:09 — 15th May 2007.
They have: 140 posts
Joined: Nov 2003
thanks very much.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.