当前位置:网站首页>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
边栏推荐
- uniCloud
- 想考中级软考,一般需要多少复习时间?
- [installation system] U disk installation system tutorial, using UltraISO to make U disk startup disk
- Typescript interface inheritance
- "Dream Cup" 2017 Jiangsu information and future primary school summer camp it expert PK program design questions
- CAS机制
- [OneNote] can't connect to the network and can't sync the problem
- 555 circuit details
- Applet jump to H5, configure business domain name experience tutorial
- JS实现链式调用
猜你喜欢
Deep understanding of Apache Hudi asynchronous indexing mechanism
枪出惊龙,众“锁”周之
CSAPP Bomb Lab 解析
China Southern Airlines pa3.1
P2788 math 1 - addition and subtraction
Find the root of equation ax^2+bx+c=0 (C language)
如何顺利通过下半年的高级系统架构设计师?
香橙派OrangePi 4 LTS开发板通过Mini PCIE连接SATA硬盘的操作方法
软考中级,软件设计师考试那些内容,考试大纲什么的?
What are the test preparation materials and methods for soft exam information processing technicians?
随机推荐
Five simple and practical daily development functions of chrome are explained in detail. Unlock quickly to improve your efficiency!
Laya common script commands
SQL Server 知识汇集11 : 约束
SQL Server knowledge collection 11: Constraints
Some superficial understanding of word2vec
Transaction rolled back because it has been marked as rollback-only解决
Deeply understand the characteristics of database transaction isolation
Basic introduction of yarn and job submission process
Is the soft test intermediate useful??
Mendeley -- a free document management tool that automatically inserts references into papers
CSAPP Bomb Lab 解析
JSON format query of MySQL
IIC Basics
Socket communication principle and Practice
简单易修改的弹框组件
Network engineer test questions and answers in May of the first half of 2022
[STM32] actual combat 3.1 - drive 42 stepper motors with STM32 and tb6600 drivers (I)
[recommendation system 01] rechub
Arduino board description
[pytorch 07] hands on deep learning chapter_ Preliminaries/ndarray exercises hands-on version