JavaScript Beginners Common Skills _javascript Skills

Source: Internet
Author: User

This article illustrates some of the techniques commonly used by JavaScript beginners. Share for everyone to use for reference. Specifically as follows:

One, javascript program storage location

<body></body> inside of HTML
*.js file inside

Second, the standard format

In HTML <body></body>, when the browser loads into the body section, it starts to execute JavaScript

 
 

Placed between the

 
 

Some of the common JS method or other to avoid causing code duplication, you can put JS into the *.js file, in HTML to introduce

 
 

Iii. Common event text box focus events

Onblur: Loss of focus events

Onfocus: Getting Focus events

onchange: Text box text Change event

Onselect: Select text Box Text Event

<input type= "text" value= "Test text!" onfocus= "if (value== ' Test text! ') {value= '} ' onblur= ' if (value== ') {value= ' Test text! '} '/>
<!--The initial value is the test text! to determine that the user has no input to set the text box blank Set default values when judgment is empty when the focus is lost-->

I hope this article will help you with the learning of JavaScript programming.

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.