当前位置:网站首页>js-bom
js-bom
2022-06-13 05:54:00 【Python's path to becoming a God】
js-BOM
brief introduction
BOM: Browser object model (Browser Object Model)
Provides content independent , Object structure that can interact with browser windows
Can realize the function
1. Pop up a new browser window
2. Move , Close and resize browser windows
3. Page forward and backward
window object
Common properties
history
Window.history Is a read-only property , No assignment exists
About customer visits URL Information about
location
About the current URL Information about
window.location="http://www.baidu.com";
Common methods
Direct use , Unwanted .
| Method name | say bright |
|---|---|
| prompt( ) | Displays a dialog box that prompts for user input |
| alert( ) | Display a warning box with a prompt and a OK button |
| confirm( ) | Display a prompt message 、 Dialog for OK and Cancel buttons |
| close( ) | Close the browser window |
| open( ) | Open a new browser window , Load given URL Specified document |
| setTimeout( ) | Call the function or computing expression after the specified millisecond count. |
| setInterval( ) | According to the specified period ( In milliseconds ) To call a function or expression |
history object
Need to use window.history To get
Common methods
| name | say bright |
|---|---|
| back() | load history Previous in object list URL |
| forward() | load history Next in object list URL |
| go() | load history A specific object in the object list URL |
location object
Need to use window.location To get
Common properties
| name | say bright |
|---|---|
| host | Set or return the host name and current URL Port number |
| hostname | Set or return to current URL The host name |
| href | Set or return to full URL |
Common methods
| name | say bright |
|---|---|
| reload() | Reload current document |
| replace() | Replace the current document with a new document |
window.location.replace("https://www.baidu.com");
js Built-in objects
Array
String
Math
| Method | say bright | Example |
|---|---|---|
| ceil() | Round up logarithm | Math.ceil**(25.5); return 26Math.ceil(-25.5); return -25** |
| floor() | The logarithm is rounded down | Math.floor(25.5); return 25Math.floor(-25.5); return -26 |
| round() | Round a number to the nearest number | Math.round(25.5); return 26Math.round(-25.5); return -26 |
| random() | return 0~1 Random number between | Math.random**(); for example :0.6273608814137365** |
// return 2~99 The random number
var iNum=Math.floor(Math.random()*98+2)
Date
var today=new Date(); // Returns the current date and time
var tdate=new Date("september 1,2013,14:58:12")
Common methods
| Method | say bright |
|---|---|
| getDate**()** | return Date Every day of the month of the object , Its value is between 1~31 Between |
| getDay**()** | return Date Every day of the subject's week , Its value is between 0~6 Between |
| getHours**()** | return Date Hours of objects , Its value is between 0~23 Between |
| getMinutes**()** | return Date Minutes of objects , Its value is between 0~59 Between |
| getSeconds**()** | return Date The number of seconds of the object , Its value is between 0~59 Between |
| getMonth() | return Date Month of object , Its value is between 0~11 Between , January is 0 |
| getFullYear() | return Date Year of object , Its value is 4 digit |
| getTime() | Back from a moment (1970 year 1 month 1 Japan ) Milliseconds since |
Timing function
setTimeout()
function timer(){
var t=setTimeout("alert('3 seconds')",3000);
}
//3 Once per second
setinterval()
var myTime=setInterval("disptime() ", 1000 );
Clear function
clearTimeout()
var t=setTimeout("alert('3 seconds')",3000);
clearTimeout(t);
clearInterval ()
var myTime=setInterval("disptime() ", 1000 );
clearInterval(myTime);
边栏推荐
- 10 signalstartevent and signalcatchingevent of flowable signal events
- Implementation of concurrent programming locking
- 20 flowable container (event sub process, things, sub process, pool and pool)
- Leetcode planting flowers - simple
- Leetcode- keyboard line - simple
- Four shardingsphere JDBC sharding strategies
- August 15, 2021 another week
- [automated test] cypress manual
- Etcd understanding of microservice architecture
- High availability of Nacos series
猜你喜欢

Four shardingsphere JDBC sharding strategies

NVIDIA Jetson nano/xavier NX capacity expansion tutorial

Timeout thread log for tongweb

Service fusing and degradation of Note Series

10 signalstartevent and signalcatchingevent of flowable signal events

Ffmpeg download suffix is Video files for m3u8

MongoDB 多字段聚合Group by

16 the usertask of a flowable task includes task assignment, multi person countersignature, and dynamic forms

SPI primary key generation strategy for shardingsphere JDBC

Zero copy technology
随机推荐
Explanation of sentinel series' features, composition and deployment
3. Postman easy to use
Service fusing and degradation of Note Series
Leetcode- hex number - simple
Function and application scenario of field setaccessible() method
Integration of sentinel series Nacos to realize rule synchronization and persistence
Explanation of service registration and discovery API of Nacos series
Etcd fast cluster building
No assessment summary
Working principle of sentinel series (concept)
Shardingsphere JDBC exception: no table route info
Interrupt processing
Service architecture diagram of Nacos series
20 flowable container (event sub process, things, sub process, pool and pool)
Leetcode- find a difference - simple
Leetcode- reverse string ii- simple
Django uploads local binaries to the database filefield field
Unity游戏优化(第2版)学习记录7
[automated test] cypress manual
Concurrent programming -- what is threading?