web前端第二次作业

1,对象

let{

    属性

    方法

}

2,闭包

只有函数内部的子函数才能读取局部变量,所以闭包可以理解成定义在一个函数内部的函数,在本质上,闭包是将函数内部和函数外部连接起来的桥梁。

3,math

 console.log(Math.floor(a))向下取整
 console.log(Math.ceil(b)) 向上取整
 console.log(Math.max())最大值
 console.log(Math.min())最小值
 console.log(Math.floor(Math.random() * ((20 - 10) + 1)) + 10)随机数
 console.log(Math.round()四舍五入
 console.log(Math.sqrt())开平方根
 console.log(Math.pow(, ))幂次方

4,date 

let year = date.getFullYear()年

let m = date.getMonth() + 1 月

let day = date.getDate()天

let hh = date.getHours()时

let mm = date.getMinutes()分

let ss = date.getSeconds()秒

let w = date.getDay()星期

return `${year}-${m}-${day} ${hh}:${mm}:${ss} 今天星期${w}`}

5, 获取元素对象

document.querySelector("css选择器")

document.querySelectorALL 选全部

 6,改变元素属性

对象.属性 = 值

7,改变Style样式

1、对象.style.样式 = ""

碰见带-的符合属性,采用小驼峰的方式规避使用

box.classList.add()追加新的类名到元素对象上

box.classList.remove("box1") 移除元素对象的类名

像是checked这样的属性名=属性值的属性,js再进行赋值时,通过true/false去控制属性值

8,事件监听

 事件:事件源 事件类型 处理函数

l0 on事件类型    

  1. 事件源.on事件类型=function(){}

  2. 同一个事件源,后面注册的事件会对前面注册的事件进行覆盖

l1 事件监听 不会覆盖

倒计时作业

小米

 

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>* {margin: 0;padding: 0;box-sizing: border-box;}li {list-style: none;}a {text-decoration: none;}.content {width: 1226px;margin: 0 auto;}.header {height: 40px;background-color: #333;color: #B0B0B0;font-size: 12.68px;}.header .content {display: flex;justify-content: space-between;}.header-left {width: 790px;}.header-right {width: 230px;}.header .content a {font-size: 12px;color: #B0B0B0;line-height: 40px;}.header .sep {margin: 0 3.6px;}.header .shopping {margin-left: 20px;}.top-nav {height: 100px;overflow: hidden;}.top-nav .content {display: flex;justify-content: space-between;}.top-nav-left {width: 56px;height: 56px;background: url("https://cdn.cnbj1.fds.api.mi-img.com/mi.com-assets/shop/img/logo-mi2.png") no-repeat;background-size: 56px;margin-top: 20px;}.top-nav-mid ul {display: flex;justify-content: space-between;width: 700px;height: 100px;line-height: 100px;}.top-nav-mid ul a {color: #333;}.top-nav-right {padding-top: 25px;width: 296px;height: 100px;line-height: 100px;}.top-nav-right form {position: relative;width: 296px;height: 50px;}.top-nav-right input {position: absolute;left: 0;top: 0;width: 245px;height: 50px;vertical-align: middle;outline: none;}.top-nav-right span {display: inline-block;position: absolute;right: 0;top: 0;width: 52px;height: 50px;line-height: 50px;border: 1px solid black;text-align: center;font-size: 24px;}.xia{width: 1226px;height: 460px;background: url("") no-repeat;background-size: 1226px 460px;margin: 0 auto;}.xia .content{position: relative;}.xia .content .left ul{width: 234px;height: 460px;display: block;font-size: 14px;font-weight: 400;line-height: 21px;padding: 20px 0px;}.xia .content .left ul li{display: list-item;text-align: left;}.xia ul li a{width: 234px;height: 42px;display: block;height: 42px;line-height: 42px;position: relative;padding-left: 30px;float: left;}a{font-size: 12px;text-decoration: none;color: inherit;}.xia .content .zb{left: 234px;top: 230px;position: absolute;}.xia .content .yb{right:0px;top: 230px;position: absolute;}.xia .content .xb{box-sizing:inherit;right:30px;bottom: 20px;position: absolute;}.xia .content .xb ul{display: flex;flex-direction: row;}.xia .content .xb a{width: 10px;height: 10px;}.xia .content .xb ul li{list-style: disc;}.xia .content .xb ul li::marker {font-size: 15px;}.buttom{margin-top: 15px;}.buttom .content .aaa{background-color: rgb(95, 87, 80);float: left;line-height: 21px;font-size: 12px;}.buttom .content .aaa ul{width: 234px;height: 170px;line-height: 18px;text-align: center;}.buttom .content .aaa ul li{display: list-item;float: left;width: 70px;height: 82px;padding: 0px 3px;position: relative;text-align: center;}.buttom .content .aaa li a{width: 70px;height: 64px;color: #ffff;display: block;font-size: 12px;line-height: 18px;padding-top: 18px;text-align: center;}.buttom .zhaopian{width: 978px;height: 170px;float: right;}.buttom .zhaopian ul{width: 978px;height: 170px;padding: 0;margin: 0;}.buttom .zhaopian ul li{float: left;margin-left: 15px;}.buttom .zhaopian ul li:nth-child(1) {margin-left: 0px;}.buttom .zhaopian ul li a{display: block;box-sizing: border-box;}.buttom .zhaopian ul li a img{height: 170px;width: 315px;text-align: left;position: relative;}</style>
</head><body><div class="header"><div class="content"><div class="header-left"><a rel="nofollow" href="//www.mi.com/" >小米官网</a><span class="sep">|</span><a rel="nofollow" href="//www.mi.com/shop" >小米商城</a><span class="sep">|</span><a rel="nofollow" href="//hyperos.mi.com/" target="_blank">小米澎湃OS</a><span class="sep">|</span><a rel="nofollow" href="//iot.mi.com" target="_blank">IoT</a><span class="sep">|</span><a rel="nofollow" href="//i.mi.com/" target="_blank">云服务</a><span class="sep">|</span><a rel="nofollow" href="//airstar.com/home" target="_blank">天星数科</a><span class="sep">|</span><a rel="nofollow" href="//youpin.mi.com/" target="_blank">有品</a><span class="sep">|</span><a rel="nofollow" href="//xiaoai.mi.com/" target="_blank">小爱开放平台</a><span class="sep">|</span><a rel="nofollow" href="//www.mi.com/aptitude/list/?id=88" target="_blank">资质证照</a><span class="sep">|</span><a rel="nofollow" href="//www.mi.com/aptitude/list/" target="_blank">协议规则</a><span class="sep">|</span><a rel="nofollow" href="//www.mi.com/appdownload/" target="_blank">下载app</a><span class="sep">|</span><a rel="nofollow" href="#">Select Location</a></div><div class="header-right"><a href="#">登录</a><span class="sep">|</span><a href="#">注册</a><span class="sep">|</span><a href="#">消息通知</a><span class="shopping"><a href="#"><span class="iconfont icon-gouwuche"></span>购物车</a></span></div></div></div><div class="top-nav"><div class="content"><div class="top-nav-left"></div><div class="top-nav-mid"><ul><li><a href="#">xiaomi手机</a></li><li><a href="#">xiaom手机</a></li><li><a href="#">手机</a></li><li><a href="#">小手机</a></li><li><a href="#">手机</a></li><li><a href="#">手机</a></li><li><a href="#">xia手机</a></li><li><a href="#">xiaomi手机</a></li><li><a href="#">手机</a></li></ul></div><div class="top-nav-right"><form action="#"><input type="text"><span class="iconfont icon-sousuo"></span>  </form></div></div></div><div class="xia"><div class="content"><div class="left"><ul><li><a rel="nofollow" href="#">手机</a></li><li><a rel="nofollow" href="#">电视</a></li><li><a rel="nofollow" href="#">家电</a></li><li><a rel="nofollow" href="#">笔记本平板</a></li><li><a rel="nofollow" href="#">出行穿戴</a></li><li><a rel="nofollow" href="#">耳机音响</a></li><li><a rel="nofollow" href="#">健康儿童</a></li><li><a rel="nofollow" href="#">生活箱包</a></li><li><a rel="nofollow" href="#">智能路由器</a></li><li><a rel="nofollow" href="#">电源配件</a></li></ul></div><div class="right"><div class="zb"><span class="iconfont icon-zuo"></div><div class="yb"><span class="iconfont icon-you"></div><div class="xb"><ul><li><a rel="nofollow" href="#">&ensp;</a></li><li><a rel="nofollow" href="#">&ensp;</a></li><li><a rel="nofollow" href="#">&ensp;</a></li><li><a rel="nofollow" href="#">&ensp;</a></li><li><a rel="nofollow" href="#">&ensp;</a></li><li><a rel="nofollow" href="#">&ensp;</a></li></ul></div></div></div></div>  <div class="buttom"><div class="content"><div class="aaa"><ul><li><a rel="nofollow" href="#"><span></span>保障范围</a></li><li><a rel="nofollow" href="#"><span></span>企业团购</a></li><li><a rel="nofollow" href="#"><span></span>F码通道</a></li><li><a rel="nofollow" href="#"><span></span>米粉卡</a></li><li><a rel="nofollow" href="#"><span></span>以旧换新</a></li><li><a rel="nofollow" href="#"><span></span>话费充值</a></li></ul></div><div class="zhaopian"><ul><li></li><li></li><li></li></ul></div></div></div>
</body>
</html>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/636652.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

使用Docker搭建Redis主从集群

文章目录 ☃️前言☃️搭建❄️❄️架构❄️❄️实例说明❄️❄️搭建第一个服务器上的两个实例❄️❄️搭建第二个服务器上的一个实例 ☃️开启主从❄️❄️改配置❄️❄️重启从节点 ☃️验证 ☃️前言 单节点 Redis 的并发能力是有上限的&#xff0c;要进一步提高Redis的并…

项目管理-项目开发计划介绍

目录 一、内容总览 二、项目开发计划概述 2.1 概述 2.2 项自开发计划的目的和作用 2.3 项目开发计划的内容 2.3.1 工作计划 2.3.2 人员组织计划 2.3.3 设备采购和资源供应计划 2.3.4 配置管理计划 2.3.5 进度安排计划 2.3.6 成本投资计划 2.3.7 质量保证计划 2.3.8…

Json三方库介绍

目录 Json是干什么的Json序列化代码Json反序列化代码 Json是干什么的 Json是一种轻量级的数据交换格式&#xff0c;也叫做数据序列化方式。Json完全独立于编程语言的文本格式来存储和表述数据。易于人阅读和编写&#xff0c;同时也易于机器解析和生成&#xff0c;并有效地提升…

STM32H750外设ADC之双重 ADC 模式

目录 概述 1 双重 ADC 模式介绍 1.1 双重 ADC模式 1.2 双重 ADC 模式的类型 2 双重 ADC 模式寄存器的配置 3 模式功能实现 3.1 注入同步模式 3.2 支持独立注入的常规同步模式 3.2.1 中断的方式 3.2.2 DMA 读取常规数据 3.3 支持独立注入的交替模式 3.3.1 中断触发…

企业车辆违章查询工具,批量查询企业名下车辆违章情况,专为网约车/出租车管理公司而生

功能介绍 功能分为&#xff1a;违章管理、车辆管理、任务管理 违章管理如图&#xff1a; 搜索条件为车牌号 筛选条件为&#xff1a;时间区间、企业选择、是否处理违章、是否缴纳罚款、所属车管员 车牌管理如图&#xff1a; 可以新增车牌 查询条件为&#xff1a;车牌信息、车…

24五一杯资料汇总!!!!

以下内容为23年五一杯内容&#xff0c;24年也将会按时更新资料&#xff01;&#xff01;&#xff01; 问题1&#xff1a;给定建筑物数据&#xff0c;假设该建筑物内温度需要一直保持在18-26度&#xff0c;在温度不适宜的时候要通过电来调节温度&#xff0c;消耗一度电相当于0.…

最新网课交单平台源码 网课下单源码 网课平台搭建源码 网课对接平台搭建

内容目录 一、详细介绍二、效果展示1.部分代码2.效果图展示 三、学习资料下载 一、详细介绍 网课交单平台源码最新修复全开源版本 去除论文编辑 去除强国接码 修复上级迁移 修复聚合登录 修复支付不回调 优化支付接口兼容码/易支付 优化MySQL表&#xff0c;提高网页加载…

14. Spring AOP(二)实现原理

源码位置&#xff1a;spring_aop 上一篇文章中我们主要学习了AOP的思想和Spring AOP使用&#xff0c;本文讲的是Spring是如何实现AOP的&#xff0c;Spring AOP是基于动态代理来实现AOP的&#xff0c;在将动态代理之前先来了解一下什么是代理模式。 1. 代理模式 在现实中就有许…

如何查询下载自然资源相关的法律法规

自然资源部门户网站- 政策法规库 (https://f.mnr.gov.cn/) 以查询下载“节约用水条例”为例&#xff1a;输入标题&#xff0c;点击检索&#xff0c;出现对应的检索结果&#xff1a; 打开详细&#xff0c;可以看到节约用水条例的详细内容&#xff1a; 点击文后的打印或者下载&a…

构建信息安全感知程序(一)

原文&#xff1a;annas-archive.org/md5/cb5e79ad1f7a31eaf76b82b01d6af659 译者&#xff1a;飞龙 协议&#xff1a;CC BY-NC-SA 4.0 前言 公司每年投入数百万美元购买最新的安全产品&#xff0c;从防火墙到门禁系统&#xff0c;但他们未能投资于保护环境中最宝贵的资源——更…

【C++类和对象】const成员函数及流插入提取

&#x1f49e;&#x1f49e; 前言 hello hello~ &#xff0c;这里是大耳朵土土垚~&#x1f496;&#x1f496; &#xff0c;欢迎大家点赞&#x1f973;&#x1f973;关注&#x1f4a5;&#x1f4a5;收藏&#x1f339;&#x1f339;&#x1f339; &#x1f4a5;个人主页&#x…

【论文精读】Attention is all you need

摘要 主要的序列转换模型是基于复杂的循环或卷积神经网络&#xff0c;其中包括一个编码器和一个解码器。性能最好的模型还通过一种注意力机制将编码器和解码器连接起来。我们提出了一种新的简单的网络架构&#xff0c;Transformer&#xff0c;完全基于注意机制&#xff0c;完全…