Summary of JavaScript debugging _ ax

Source: Internet
Author: User

Declaration: This post is really gold-rich, so I am afraid you will enter Baoshan!

The reason for not doing this is:
① The original has been written.
1. There is no such email number, or the email name is incorrect.
2. When the HTML control value is obtained, the row cannot be merged because the obtained result is incorrect.
3. The syntax is incorrect. See note 1.
② The HTML control and function name are the same

I have encountered the following situations:
1. I wrote half a bracket and checked it for half a day.
2. Generally, name is used for retrieving objects. See note 2.
3. debugging is really difficult. You can only use alert (); statement to try again without syntax check.Who has a good idea ??
4. Chinese characters cannot be entered as ID/name !!, You don't believe it? Just give it a try.
5. Dropped a concatenation string's +
6. When I write my previous postCodeWrite comments and forget to cause the comments.
7. The for statement is written as follows: For (INT I = 0; I <5; I ++) {} seems to be correct. Check for n times. Why? Q: What is int type ????
Positive Solution:
For (VAR I = 0; I <5; I ++ ){}

Note 1: I used a switch statement. In the syntax, there is no break after case, and I did not write it myself. The result can be imagined: I executed each case once, there may be a small error in the original good help materials. One word: Wu!
NOTE 2:Remember: Obtain all HTML controls using their names, such as: document. mailform. mailselect. value; among them, mailform mailselect is the control name, only one case will use ID: document. getelementbyid ("ax"); where ax is the ID of a control, and the getelementbyid () method is the method of the Document Object. In other words, getelementbyid can only be used after the document, it's all about Dom !!!How can no one tell new people about such an important thing?

[Conclusion] The baseline encoding method is not practical. When writing JavaScript code, it fails to develop a good encoding format, and even a low-level mistake such as dropping parentheses occurs (maybe I deleted a few when I deleted them, if I did not write one at the time of writing, I wouldn't believe it when I killed it, and I wrote the parentheses in pairs.) I read the first ten chapters of this DHTML book two days ago, for HTML, CSS, javaScript and Dom have a closer understanding. I hope you can take a look at this book.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.