JavaScript actions 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 box
confirm () message with a display, and determining cancel button in the dialog box
close () Close the browser window
open () opens a new browser window to load the given URL specified in the document
setTimeout () function call after a specified number of milliseconds or calculation expression
setInterval () specified intervals (to milliseconds) to the calling function or expression
Date:
getDate () Date object of each day of the month, a value 31 is between ~. 1
getDay () Date object of each day of the week, which is a value between ~. 6 between 0
getHours () returns the number of hours Date object whose value is between ~ 23 is 0
getMinutes () returns the number of minutes Date object whose value is between 59 ~ 0
the getSeconds () Date object number of seconds, a value between 59 ~ 0
the getMonth () returns the month Date object, a value between 0 and 11
years the getFullYear () Date object, a value of 4 digits
getTime () returns since a certain time (1 January 1970) the number of milliseconds
the Math:
ceil () logarithm rounded Math.ceil (25.5); return 26
Math.ceil (-25.5); return -25
Floor () rounding the logarithm Math.floor (25.5); return 25
Math.floor (-25.5); returns -26
round () the number of Rounding to the nearest number Math.round (25.5); return 26
Math.round (-25.5); returns -26
Random () returns a random number Math.random (between 0 and 1); for example: 0.6273608814137365

// Timer: 
        the setTimeout:
             // After much ms trigger 
            the setTimeout (function () {
                 / * Alert ( 'Hongtao'); * / 
            }, 3000 ); 
        the setInterval: 
        // representing each trigger ms 
            var interval The = the setInterval (function ( ) {
                 // create a Date object 
                var = datetime new new 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; 
                // trigger the start button click 
                function Start () {
                     // each -1 second 
                    interval The = the setInterval (function ( ) { 
                        Time - ;
                         // to span assignment 
                        document.getElementById ( 'Time') = the innerHTML. Time;
                         IF (Time <= 0 ) {
                             // stop the timer
                            clearInterval(interval);
                        }
                    }, 1000);
                };
                
                function stop() {
                    clearInterval(interval);
                };

            </script>
        

 

Guess you like

Origin www.cnblogs.com/danxun/p/10967366.html