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.