javaScript operating BOM
property of the window object:
history:
Method:
the Back () before loading a URL history list of objects in the
forward () to load the next URL history list of objects
go () to load history of a particular list of objects in the URL of
LOCATION:
Properties:
host Sets or returns the host name and the URL of the current port number
hostname Sets or returns the host name of the current URL
href Sets or returns the full URL
method:
reload () reload the current document
replace () Replaces the current document with a new document
document:
attribute:
referrer URL returns the load current document
URL to return the current document URL
method:
getElementById () returns a reference to the id has designated the first object
returns the object with the specified name of getElementsByName () collection
getElementsByTagName () returns with a specified collection object tag name of
a method object window:
prompt () displays the dialog can prompt the user to enter the
alert () is displayed with a warning message and an OK button of the box
confirm () display with a message, OK and Cancel buttons in dialog boxes
close () Close the browser window
open () opens a new browser window to load the given URL specified in the document
setTimeout () at the specified milliseconds after the call number or function calculation expression
setInterval () at a specified interval (in milliseconds) to the calling function or the expression
: Date
each day, a value of between 1 and 31 month getDate () Date object in Room
getDay () Date object of each day of the week, which is a value between. 6 ~ 0
getHours () returns the number of hours Date object whose value is between ~ 23 is 0
getMinutes () Date object minutes number, with values between 59 ~ 0
the getSeconds () returns the number of seconds Date object, values between 59 ~ 0
the getMonth () returns the month Date object, the value is between. 11 ~ 0
the getFullYear ( ) Year Date object, its value is 4 digits
getTime () returns the number of milliseconds from a time (January 1, 1970) since
the Math:
ceil () logarithm rounded Math.ceil (25.5) ; return 26 is
Math.ceil (-25.5); returns -25
Floor () logarithm Rounding Math.floor (25.5); return 25
Math.floor (-25.5); returns -26
round () the number rounded to the nearest number Math.round (25.5); return 26 is
Math.round (-25.5); returns -26
Random () returns 0 ~ 1 of Math.random random number between (); for example: 0.6273608814137365
timers:
the setTimeout:
after much ms // trigger
the setTimeout (function () {
/ * Alert ( 'Hongtao'); * /
}, 3000);
the setInterval:
// Representative ms per trigger
var interval the = the setInterval (function () {
// create a Date object
var = new new datetime Date ();
//01.getElementById () Gets the element with an id attribute value
var span = document.getElementById ( 'span01 ');
span.innerHTML = datetime;
}, 1000);
case:
<Script type = "text / JavaScript">
var time = 10;
var interval The;
triggered // start button clicks
Start function () {
// each -1 second
interval The = the setInterval (function () {
TIME -;
// Assignment to span
document.getElementById ( 'Time') the innerHTML = Time;.
IF (Time <= 0) {
// stop the timer
the clearInterval (interval The);
}
}, 1000);
};
function sTOP () {
the clearInterval (interval The);
};
</script>
property of the window object:
history:
Method:
the Back () before loading a URL history list of objects in the
forward () to load the next URL history list of objects
go () to load history of a particular list of objects in the URL of
LOCATION:
Properties:
host Sets or returns the host name and the URL of the current port number
hostname Sets or returns the host name of the current URL
href Sets or returns the full URL
method:
reload () reload the current document
replace () Replaces the current document with a new document
document:
attribute:
referrer URL returns the load current document
URL to return the current document URL
method:
getElementById () returns a reference to the id has designated the first object
returns the object with the specified name of getElementsByName () collection
getElementsByTagName () returns with a specified collection object tag name of
a method object window:
prompt () displays the dialog can prompt the user to enter the
alert () is displayed with a warning message and an OK button of the box
confirm () display with a message, OK and Cancel buttons in dialog boxes
close () Close the browser window
open () opens a new browser window to load the given URL specified in the document
setTimeout () at the specified milliseconds after the call number or function calculation expression
setInterval () at a specified interval (in milliseconds) to the calling function or the expression
: Date
each day, a value of between 1 and 31 month getDate () Date object in Room
getDay () Date object of each day of the week, which is a value between. 6 ~ 0
getHours () returns the number of hours Date object whose value is between ~ 23 is 0
getMinutes () Date object minutes number, with values between 59 ~ 0
the getSeconds () returns the number of seconds Date object, values between 59 ~ 0
the getMonth () returns the month Date object, the value is between. 11 ~ 0
the getFullYear ( ) Year Date object, its value is 4 digits
getTime () returns the number of milliseconds from a time (January 1, 1970) since
the Math:
ceil () logarithm rounded Math.ceil (25.5) ; return 26 is
Math.ceil (-25.5); returns -25
Floor () logarithm Rounding Math.floor (25.5); return 25
Math.floor (-25.5); returns -26
round () the number rounded to the nearest number Math.round (25.5); return 26 is
Math.round (-25.5); returns -26
Random () returns 0 ~ 1 of Math.random random number between (); for example: 0.6273608814137365
timers:
the setTimeout:
after much ms // trigger
the setTimeout (function () {
/ * Alert ( 'Hongtao'); * /
}, 3000);
the setInterval:
// Representative ms per trigger
var interval the = the setInterval (function () {
// create a Date object
var = new new datetime Date ();
//01.getElementById () Gets the element with an id attribute value
var span = document.getElementById ( 'span01 ');
span.innerHTML = datetime;
}, 1000);
case:
<Script type = "text / JavaScript">
var time = 10;
var interval The;
triggered // start button clicks
Start function () {
// each -1 second
interval The = the setInterval (function () {
TIME -;
// Assignment to span
document.getElementById ( 'Time') the innerHTML = Time;.
IF (Time <= 0) {
// stop the timer
the clearInterval (interval The);
}
}, 1000);
};
function sTOP () {
the clearInterval (interval The);
};
</script>