Special characters in the string:
In JS, double-quote content in double-quote strings and single quotation marks in single-quote strings must be transferred in the following form:
var str1 = "My mother say:\" don ' t speak with Stranger\ ". ";
var str2 = ' My mother say: ' don\ ' t speak with stranger '. ';
The commonly used escape characters in JS are:
" ? \ "' ? \ ' carriage return? \ r newline character? \ntab \t\ ? \ n Note: Carriage return, line break, space and tab characters are actually also with a,b,c,d, and ', ', $ & Wait for the symbol "equal juxtaposition".
Time Date Object:
The object used to represent the time date data. A time-date object includes specific information about the time and date, such as year, month, day, minute, millisecond, and week.
A time-date object is defined in the following ways:
New Date (); // new Date ("9/page: : "); Use a string to define a date object of a specified time (moment) new date(9 - + ); Use multiple (at least 3) numbers to define a date object of a specified time new date (2324624252312); A number is used to define a date object of a specified time.
This number represents the number of milliseconds that have elapsed since the start of the January 1, 1970 midnight 0:0 0 seconds (or even 0 millimeters). Note that one second is equal to 1000 milliseconds. In fact, we can understand that: "Time" this data, in JS, in fact, it is essentially just a number stored. If the value is negative, it indicates a forward projection. In fact, the time can be calculated by adding and subtraction.
This point in time is generally considered to be the "starting point/origin" of the computer world.
Common methods for TIME objects:
V1 = d1.tolocalestring (); The acquisition time is "local notation" = d1.gettime (); Get a "millimeter" of a time-starting from the time origin. The following is a data value in the acquisition time: = d1.getfullyear (); // get the number of years--is a number, the same as V1 = d1.getmonth (); // get the number of months-note: This number is calculated starting from 0, which can only be: 0-11 v1 = d1.getdate (); // number of dates acquired V1 = D1.getday (); // get the number of weeks V1 = d1.gethours (); // get the number of hours V1 = d1.getminutes (); // get the number of minutes V1 = d1.getseconds (); // gets the number of seconds V1 = d1.getmilliseconds (); Get the number of milliseconds
The following are some of the data values in the setup time:
D1.setfullyear (n); // Set the number of years D1 this time object to n-that is, the year is modified, the same as the same. d1.setmonth (n ); // sets the number of months D1. SetDate (n ); // set the number of dates D1. Setday (n ); // set the number of weeks D1. Sethours (n ); // set number of hours D1. Setminutes (n ); // set the number of minutes D1. Setseconds (n ); // set number of seconds D1. Setmilliseconds (n ); Set the number of milliseconds
Introduction to Web Page objects
The first important idea: every tag in an HTML file is an object.
var obj1 = { name: "Floret", age : zuofan:functoin () {...}, Xiyi: function () {...}} var v1 = obj1.age; Alert (v1); ; // Chinese New Year , added a year old--modified the Obj1 This object's age this property value. obj1.name = "Big Flower";
How to get a page label object:
var obj1 = document.getElementById ("id name");
To manipulate the label properties of an object:
Get: var v1 = obj1. Tag property name;
Assignment: Obj1. Tag Property name = value;
Style properties for manipulating objects:
Get: var v1 = obj1.style. Style property name;--in fact, this way only gets its "inline style"
Assignment: Obj1.style. Style property name = value;
How to get a page label object:
var obj1 = document.getElementById ("id name");
To manipulate the label properties of an object:
Get: var v1 = obj1. Tag property name;
Assignment: Obj1. Tag Property name = value;
Style properties for manipulating objects:
Get: var v1 = obj1.style. Style property name;--in fact, this way only gets its "inline style"
Assignment: Obj1.style. Style property name = value;
Incident Preliminary
Simply put, the event is "action", that is, a user's operation, such as: Click, mouse movement, double-click, ...
First review and strengthen the "definition" JS: JS is an object-based event-driven scripting language.
What are the events:
Mouse event: onclick: onmouseover: onmouseout: ondblclick: Double-click event onmousedown: Mouse down when the time occurs (note that the mouse is not lifted up) onmouseup: the mouse lifted up when the onmousemove: When the mouse movement occurs-mobile everywhere.
Keyboard event: onkeypress: button click once occurs. OnKeyDown: onkeyup Occurs when the button is pressed down : when the button is lifted up
Form event: onsubmit : Occurs when a form is being "committed" onfocus: occurs when a form item "gets Focus". onblur: occurs when a form item "loses focus" onchange: When the data of a single table item changes--usually only for the Select label option Change.
Other: onload: occurs when the page "A load succeeds", that is, when the page opens,--onload can only appear once on a page. The onload can only be written on the body tag, or it is not written in the label, but instead uses the solid line of window.onload in the script.
Summary: Events occur at any time and are ubiquitous, only in what event we want to use on which object to accomplish what work.
Its basic code pattern is:
<标签名 ……="" on事件名="”函数名f1();”">
......
The basic implication is that when something happens to an object, it calls a function to accomplish some sort of task.
Event Object
An event is an object within a browser (note, not a Web label object), which represents the collection of relevant information about the event when it occurs (the object is the collection of information)-it only exists when the event occurs!
An event is typically used only to obtain information about the time the event occurred, such as the coordinates of the mouse at that moment (x and Y), which page object was the event, which mouse button was triggered when the event occurred, or which key on the keyboard. The above information is obtained by the following event properties:
event.clientx--gets the x-coordinate position of the mouse when the event occurs
event.clienty--Gets the y-coordinate position of the mouse when the event occurs
event.target--Gets the tag object (for FF) when the event occurs--similar to the getElementById acquired object
event.srcelement--gets the tag object when the event occurred (for IE)-similar to the getElementById acquired object
-the Label object at the time of the event is often referred to as the "event source."
event.keycode--the key value of the key when the keyboard event occurs--each key on the keyboard corresponds to a numeric value.
comparison of this and event usage:
This
<标签名1 on事件名="”函数名f1(
) " > .....
<标签名2 on事件名="”函数名f2(
Event) " > .....
The above describes the PHP Basic Learning Note JavaScript (5), including the content, I hope the PHP tutorial interested in a friend helpful.