I. Review of the previous section
1, Inline-block
The default is 3px width
2, Change the label
Web small triangle creates visual effects
<! DOCTYPE html>
3. img Tag
The IMG border is displayed by default in ie, so set the boder=0
4. Attribute Selector
<! DOCTYPE html>
5. Clear Floating
<! DOCTYPE html>
6. Label Default Value
<! DOCTYPE html>
second, JavaScript
JavaScript is a network scripting language, has been widely used in Web application development, often used to add a variety of dynamic features for Web pages, to provide users with more smooth and beautiful browsing Effect. JavaScript scripts are typically embedded in HTML to implement their own functionality, and are interpreted by the Browser's built-in JavaScript interpreter.
1. form of existence
The first way: import JS file
<script type "text/javascript" src= "js file" ></script>
The second way:
<script type "text/javascript" > JS code content </script>
2. Placement Position
The first way: placed in the head of HTML
The second way: (recommended) placed at the bottom of the body code block of HTML
Because the HTML code is executed from top to bottom, if the JS code in the head is time consuming, it will cause the user to be unable to see the page for a long time, if it is placed at the bottom of the body code block, even if the JS code is time consuming, it will not affect the user to see the page Effect.
3. variables
Local variables must start with a var, and if Var is not used, the default representation is to declare a global variable.
Start with var, like var a = 123;
Name = ' Eric ';
4. Comments
This comment takes effect only in a script block
//
/* */
5. Data Type
Numbers: in javascript, integer and floating-point values are not distinguished, and all numbers are represented by floating-point numbers.
Parseint () Converts a value to a number, or Nan if unsuccessful
Parsefloat () Converts a value to a floating-point number, or Nan if unsuccessful
NaN, not a number, can be judged using IsNaN (num).
Infinity, infinitely large, can be judged using isfinite (num).
Name = ' Eric '; age = number, var a = 111parseInt ("3.6");p arsefloat ("4.9");
String: A string is an array of characters, but in JavaScript the string is immutable: you can access text anywhere in the string, but JavaScript does not provide a way to modify the contents of a known String.
obj.length length Obj.trim () Remove blank obj.trimleft () obj.trimright) obj.charat (n) returns the nth character in a string Obj.concat (value, ...) Stitching Obj.indexof (substring,start) sub-sequence position obj.lastindexof (substring,start) sub-sequence position obj.substring (from, to) Get sub-sequence obj.slice (start, end) slice obj.tolowercase () uppercase Obj.touppercase () based on index The lowercase obj.split (delimiter, limit) split obj.search (regexp) matches from the beginning, returning the first position where the match succeeded (g Invalid) Obj.match (re Gexp) Global search, If there is a G in the regular means find all, otherwise only find the first One. Obj.replace (regexp, Replacement) replaced, There is g in the regular replaces all, otherwise only the first match, $ number: matches the nth group content; $&: the content of the current match; $ ': text that is located to the left of the matched substring; $ ': text on the right side of the matching substring $$: Direct volume $ character
Example of a marquee:
<! DOCTYPE html>
Boolean value:
The Boolean type contains only true and false, unlike python, whose first letter is Lowercase.
- = = Compare Values equal
- ! = does not equal
- = = = Comparison value and type are equal
- !=== Not equal to
- || Or
- && and
Python Learning Path 15