当前位置:网站首页>DOM day_02(7.8)网页制作流程、图片src属性、轮播图、自定义属性、标签栏、输入框事件、勾选操作、访问器语法
DOM day_02(7.8)网页制作流程、图片src属性、轮播图、自定义属性、标签栏、输入框事件、勾选操作、访问器语法
2022-07-26 22:38:00 【加1床铺盖】
一、网页制作流程

二、图片src属性
src属性: 作用是关联要显示的图片路径


练习:悬浮头像,跳转到成对应的大图

二、轮播图
案例一:鼠标悬浮到小圆点,切换对应的图片,切换图片时有渐变效果


案例二:鼠标悬浮到小圆点,切换对应的图片,切换图片时有滑动效果,图片并列排列,多余的部分隐藏,事件定位到需要显示的图片,通过设置x轴偏移量,左右移动去实现展示效果。


三、自定义属性
HTML元素 官方提供了很多属性
自定义属性: 可以在标签上声明自定义的属性
通过 data- 开头, 可以书写任意自定义属性. 存储在 dataset 中

四、标签栏


五、输入框事件
使用场景:
搜索栏 的实时搜索: 利用 input 事件, 例如 京东, 百度..

小练习:当输入框失去焦点时,验证手机号是否正确

五、勾选操作


六、访问器语法
JS的对象 访问器语法 分两种
点语法: 适合直接用属性名
方括号语法: 适合用变量

七、标签内容

总结
图片的src属性
通过修改此属性, 切换图片上显示的内容
自定义属性
用 data- 在标签上添加自定义属性
利用 dataset 来读取自定义属性
输入框事件
获取焦点: focus
失去焦点: blur
变化: change
实时变化: input
键盘: keyup
事件参数: 所有的事件触发时都会传递一个事件参数, 包含事件的所有信息,, 其中
keyCode属性代表具体是哪个按键, 编号13是回车
勾选: checked属性存储了勾选状态, change 是勾选事件
标签内容:
innerHTML: 读取html代码, 写入时作为html解析
innerText: 读取文本 部分, 写入时作为纯文本展示
边栏推荐
- JS, one of the methods of object merging Assign (), recursive assignment & method of array merging..., array. Concat (), array. Push. Apply (), array. Push ()
- 我的第一篇博客-迷茫的大三人
- Request attribute in crawler
- Resolve Microsoft 365 and Visio conflicts
- 运算符重载
- 【4.9 容斥原理详解】
- Error generating yolov5.wts file
- "Could not load host key" error when xshell connects to the server
- Alexnet (pytoch Implementation)
- Sliding window problem summary
猜你喜欢

裁剪tif影像

Reduced dimension mean dot product matrix multiplicative norm probability normal distribution square loss

公司给了IP地址如何使用(详细版)

9_逻辑回归(Logistic Regression)

Matlab simulation of image reconstruction using filtered back projection method

Comparative simulation of LEACH protocol performance, including the number of dead nodes, data transmission, network energy consumption, the number of cluster heads and load balance

TypeScript(tsconfig.json)

12_ Decision tree
![[Qt]容器类、迭代器、foreach关键字](/img/88/d9d5be096009b4e5baa0966e6f292c.jpg)
[Qt]容器类、迭代器、foreach关键字

继承,继承,继承
随机推荐
C语言 关机小程序
爬虫解析网页的 对象.元素名方法
Ubantu installing Oracle JDK
10_评价分类结果(Evaluate classification)
Course notes of Professor Dalin of robotics platform
RESNET paper interpretation and code implementation (pytorch)
C language shutdown applet
[3. VIM operation]
[4.1 prime number and linear sieve]
Three tier architecture simulation
Drawing warehouse-3 (functional image)
"Syntaxerror: future feature annotations is not defined"
Based on the theoretical principle and simulation results of MATLAB spherical decoding, compare 2norm spherical decoding, infinite norm spherical decoding, ML detection
C language is more than a variety of descriptions of size. Don't stick to one way of writing
c语言 static运用,灵活改变生命周期,让你写代码如鱼得水
13_ Ensemble learning and random forests
[qt] solve the problem of Chinese garbled code
3_Jupyter Notebook, numpy和matplotlib
【4.4 快速幂详解及快速幂求逆元】
C语言 求素数、闰年以及最小公倍数最大公约数