Constant: JavaScript constant, also known as literal constant, is information solidified in the program code.
Variables: The main function of variables is to access data and provide a container for accessing information.
Data Type
Integer type: Integer constant is a number, which can be decimal, octal or hexadecimal.
String: A string is one or several characters enclosed in English "" or ''.
Boolean type: Boolean constants are logical "true" and "false".
Null value: In JavaScript, "null" means nothing.
Alert box pops up: alert
A dialog box pops up to confirm "Yes/No": confirm
Output to page content: document.write
Get the built-in object: dateobj=new Date();
theYear=dateobj.getYear();
Common methods of javascript Date object
方法 |
说明 |
getDate() |
返回日期值(1-31) |
getDay() |
返回星期值(0-6) |
getHours() |
返回小时值(0-23) |
getMinutes() |
返回分钟值(0-59) |
getSeconds() |
返回秒值(0-59) |
getMonth() |
返回月份值(0-11) |
getFullYear() |
返回年份,值为4位数 |
getTime() |
返回自(1970 01 01)以来的毫秒数 |
Method |
Description |
getDate() |
Return date value (1-31) |
getDay() |
Returns the day of the week value (0-6) |
getHours() |
Return the hour value (0-23) |
getMinutes() |
Return the minute value (0-59) |
getSeconds() |
Return the second value (0-59) |
getMonth() |
Return the month value (0-11) |
getFullYear() |
Returns the year, the value is 4 digits |
getTime() |
Returns the number of milliseconds since (1970 01 01) |