当前位置:网站首页>The seventh training assignment
The seventh training assignment
2022-07-07 10:57:00 【m0_ sixty-three million five hundred and fifty-two thousand nin】
1. Built-in objects
argument Defined only inside the function , Save the arguments of the function
Array Array objects
date Date object , Used to create and obtain objects
math Mathematical objects
string String object , Provides a series of operations on strings
1.2string
charAt(idx) Returns the character at the specified location
indexof Returns the specified string position , From left to right , Cannot find return one
substring Returns the specified string m Position start , take n Characters , If parameters N Omit , It means getting the end of the string
1.3math
math.random() random number
math.ceil Rounding up , Greater than the maximum integer
1.4date
getfullyear() year
getmonth() month
getdate() Japan
gethour() when
getminute() branch
getseconds() second
explain :
getmonth() month : Time to get 0~11
setmonth(): Time set 0~11
2. object
The object is javascript Core concept of , It is also the most important data type .javascript All data types of can be regarded as objects .javascript Provide multiple built-in objects . Objects are special data types with properties and methods .
{
key : value .
key 2: value 2.
}
2.1 Object creation
js Create custom objects , There are three main ways : Literal form creation , adopt new object objects creating , adopt object Object's create Method to create an object
1. brief introduction
javascript Is an object-oriented capability , Interpretive programming language . A little bit more specific , It is an object driven and relatively secure client segment scripting language , His main purpose is , Verify the data sent to the server , increase wed Interaction , Enhance user experience
1.1.1 object
Object is plus javascript Core concept of , It is also the most important data model ,javascript All of the data can be treated as objects ,javascript Provide various internal service objects , Objects are special data types with properties and methods , In short , The object , It's an unordered set of data , It consists of several straight pairs , adopt javascript We can create our own objects ,javascript The song of this key value pair with opposite satisfaction is what we call json, I'll see you a lot later , The great json object
1.1.2 Serialization and deserialization of objects
serialize js Object serialization string , Deserialization means that the string is deserialized to js object ,js By calling json Method , You can sequence objects into strings , You can also deserialize strings into objects
1.1.3this
this yes javascript A keyword of language , It represents the function runtime , Automatically generate an internal object , Can only be used inside a function , As the function is used in different situations , Similar words will also change , But there is a general principle , This refers to the object that calls the function
2.JS event
2.1 event
Event is javascript Use the beating heart to interact with the page , When we interact with wed Some types of interactive events happen when the page is in progress , The event may be that the user clicks the mouse over certain elements or presses certain keys on the keyboard , It could be WED What happens in the browser , For example, a certain wed The page is loaded or the user scrolls to create a fire to change the window size , By using JavaScript You can monitor the occurrence of special time .
2.2 effect
1. Data entered by the user
2. Increase the dynamic effect of the page
3. Increase user experience
2.3 Several nouns of events
Event source : Who touched the event
Time name : What event triggered
Event monitoring : Who monitors this event
Event handling : What should I do when it happens
2.3 Event flow and event model
We all have a specific event source , For the time being, consider the event source as html Some element of , Then be a html When the element produces an event , This event will propagate in a specific order between the element node and the root node , All nodes passing through will be affected by this event. This propagation process is called dom Flow of events ,
There are two types of chronological order , Event capture and event bubbling , Bubbling and trapping are actually different representations of event flow , The reason for these two is love one and netscape Two big companies have completely different concepts of event flow ,ie Events are events bubbling ,netscape The event stream of is the event capture stream
3.1html Event handler
Each event supported by an element can use a with the same name as the corresponding event handler html Characteristics to develop , The value of this feature should be able to execute javascript Code , There are some disadvantages in doing so , for example , Too high coupling can also cause time difference , And on different browsers , May have different effects
3.2domo Event handler
adopt javascript The traditional way to specify event handlers , Is to assign a function to a time handler property , This approach is supported by all modern browsers , This method first requires a reference to the object to be operated , Every element has its own thing , Build handler properties , These attributes are usually all recreational , Then set the value of this attribute to a function , You can specify the world handler
边栏推荐
- IDEA快捷键大全
- JSON format query of MySQL
- 如何顺利通过下半年的高级系统架构设计师?
- 单调性约束与反单调性约束的区别 monotonicity and anti-monotonicity constraint
- How to play video on unityui
- [machine learning 03] Lagrange multiplier method
- 1324: [example 6.6] integer interval
- 香橙派OrangePi 4 LTS开发板通过Mini PCIE连接SATA硬盘的操作方法
- 书签整理-程序员常用网站导航
- 滚动踩坑--UNI_APP(八)
猜你喜欢
SQL Server knowledge gathering 9: modifying data
[pro test feasible] error while loading shared libraries solution
JSON format query of MySQL
Applet jump to H5, configure business domain name experience tutorial
软考中级,软件设计师考试那些内容,考试大纲什么的?
【推荐系统 01】Rechub
【亲测可行】error while loading shared libraries的解决方案
Operation method of Orange Pie orangepi 4 lts development board connecting SATA hard disk through mini PCIe
ThreadLocal is not enough
高级软考(网络规划设计师)该如何备考?
随机推荐
关于easyflash v3.3使用过程的记录
1324: [example 6.6] integer interval
Arduino board description
TypeScript 接口继承
【STM32】实战3.1—用STM32与TB6600驱动器驱动42步进电机(一)
CC2530 ZigBee iar8.10.1 environment construction
长列表性能优化方案 memo
Typescript interface inheritance
2022年7月10日“五心公益”活动通知+报名入口(二维码)
Application of OpenGL gllightfv function and related knowledge of light source
在线硬核工具
ADB utility commands (network package, log, tuning related)
What does intermediate software evaluator test
July 10, 2022 "five heart public welfare" activity notice + registration entry (two-dimensional code)
CAS机制
Seata 1.3.0 four modes to solve distributed transactions (at, TCC, Saga, XA)
CSAPP bomb lab parsing
Unity websocket client
【OneNote】无法连接到网络,无法同步问题
P1031 [noip2002 improvement group] average Solitaire