JS Knowledge Point
the difference between the carriage return/R and the newline character/n:/R equals Enter, which is the difference between a paragraph and a paragraph.
/n is equivalent to Shift+enter, which is the distance between rows and rows, smaller than
Several window operation methods:
1. Get the current window size and print:
var height=window.innerheight; var width = window.innerwidth;document.write ("<br/>" + "height" +height+ "," + "width" +width);
2. Open the window, close the current window
window.open ("http://baidu.com"); Window.close ();
3. Move the current window to a location (x, y)
Window.moveto (200,200);
4. Change the size of the current window (width,height)
Window.resizeto (1100,1100);
5. Get the current page address
document.write (location. href);
6, "History" page forward (forward to the previous history, equivalent to "→"), back (back to the previous history, equivalent to "←")
<!-- use the. Back method setting in another Web page - < type= "button" onClick= "A ()"= "point me forward"/>
function A () { window.history.forward (); /* forward to the previous history */ }
*navigator Visitor's browser information
Alert: Warning Box confirm: Confirmation box prompt: Prompt box
Regular expression regexp:
Methods for establishing regular expressions:
var New REGEXP (/^[0-9]{17}[0-9| x]$/); /* REGEXP () The expressions inside the parentheses need to be defined by themselves: 1, [] There is only one element 2, () inside can write a word or expression 3, {} inside the number
4. ^: start with an element and write it in front of the element
5, $: End With an element, written behind the element * /
Cases:
1. Regular Expression Authentication ID:
ID: < input type = "text" ID = "1" />
/* JavaScript Section */ var a= document.getElementById ("1"). Value; var New REGEXP (/^[0-9]{17}[0-9| x]$/); if (Patten.test (a)) { alert ("enter correct"); } Else { alert ("input error"); }
2. Regular Expression Verification mailbox:
mailbox: < input type = "text" ID = "2" /> < input type = "button" value = "Commit" onclick = "Mail ()" />
function Mail () { varnew RegExp (/^[0-9| a-z|_]{1,17}[@][0-9| a-z]{1,3}. (COM) $/) var mail = document.getElementById ("2"). Value; if (patten2.test (mail)) { alert ("enter correct"); } Else { alert ("input error");} }
11, web-making Dreamweaver (add: JS fragmented knowledge points && regular expressions)