Your Guide to Professional
Web Site Design and Development

HTML Tips
HTML Codes
Web Development
Web Design Tips
JavaScript Codes
216 Web Safe Colors
CSS Tutorial
JavaScript Tutorial
ASCII Character Codes

 

| Web Site Development | HTML Codes | HTML Tips | Web Design TipsJavascript Snippets | 216 Safe Colors | Symbols | CSS Tutorial | JavaScript Tutorial |

JavaScript Tutorial: Dealing with JavaScript Errors


You may have gotten errors when you tried to run scripts in the previous examples. Generally, errors appear not because the script is bad, but because it isn't written correctly. JavaScript, unlike HTML, is not very forgiving. It has to be written exactly right.

In JavaScript, there are two errors: Syntax Errors and Runtime Errors. Syntax errors usually mean that the code is written wrong in some way. For instance, you may have misspelled a word in the code or left a variable undefined.

Runtime Errors, on the other hand, mean that the script is broken somewhere. It may be that a command isn't all the way on the left hand side of the page, or it may be because you've accidentally added space between lines of code that shouldn't be there. Again, JavaScript is picky.

Finding errors isn't that difficult. Browsers will popup a box that tells you there is an error, and in most cases, will even tell you what line that error is on. Simply count down the lines from the top of your document, and include blank lines when counting to find your errors. You may even see multiple errors at one time on that error popup. If this is the case, start at the top and fix each error as you find it, and then run the script again after each fix. Often, one fix will correct numerous errors.

Previous

Next



  JavaScript Tutorial: An Introduction to JavaScript
  The Basics of JavaScript
  JavaScript Events
  JavaScript Variables and Arrays
  JavaScript Statements
  JavaScript Functions and Methods
  JavaScript Errors
  JavaScript Food Chain
  Writing JavaScript Code
  JavaScript Object Reference
  JavaScript Events Reference
  JavaScript Functions Reference
  JavaScript Math Object Reference
  JavaScript Array Object Reference
  JavaScript String Object Reference
  JavaScript Date Object Reference

Web Development Tutorials

  Cascading Style Sheets Tutorial: An Introduction to Cascading Style Sheets
  JavaScript Tutorial: An Introduction to JavaScript
  Web Development: A step by step guide to developing a successful Internet business
  HTML Codes Chart: Copy and paste HTML codes for your web page
  HTML Tips: Copy and paste special effect HTML codes for your web page
  Web Design Tips: Tips, tricks, and special effect codes for your web page
  JavaScript Code Snippets: Copy and paste special effect JavaScript codes for your web page
  216 Web Safe Color Chart: Hexadecimal and RGB Color Codes for your web page
  ASCII Character Codes Chart: American Standard Code for Information Interchange character codes chart