当前位置:网站首页>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: 读取文本 部分, 写入时作为纯文本展示
边栏推荐
- [4.1 prime number and linear sieve]
- UNET notes
- Uni app learning (II)
- 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
- 【Codeforces Round #807 (Div 2.) A·B·C】
- A simple prime number program. Beginners hope that older bosses can have a look
- 傅里叶分析(基础介绍)
- [4.2 approximations]
- [4.3 detailed explanation of Euler function]
- 运算符重载
猜你喜欢

Drawing warehouse-2 (function image)

2020-12-20 99 multiplication table

【4.9 容斥原理详解】

Today's 20220719 toss deeplobcut

2020-12-20 九九乘法表

Request attribute in crawler

Signal and system learning zero input response

【4.10 博弈论详解】

Viterbi Viterbi decoding bit error rate simulation, modulation is QPSK, channel is Gaussian white noise

10_评价分类结果(Evaluate classification)
随机推荐
Looking for the real murderer
动态联编和静态联编、以及多态
10_评价分类结果(Evaluate classification)
[3. VIM operation]
The crawler parses the object of the web page. Element name method
9_ Logistic regression
c语言 比大小的多种描述,不要只拘泥于一种写法
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
[LeetCode] 无重复最长字符串
Anaconda = > pycharm=> CUDA=> cudnn=> pytorch environment configuration
Error generating yolov5.wts file
Configure deeplobcut2 with your head covered
[acwing game 61]
2020-12-20 99 multiplication table
Matlab simulation of image reconstruction using filtered back projection method
2020-12-22最大公因数
[qt] meta object system
9_逻辑回归(Logistic Regression)
Leetcode high frequency question: the choice of the inn, how many options to choose accommodation, to ensure that you can find a coffee shop with a minimum consumption of no more than p yuan in the ev
torch.相关函数