当前位置: 首页 > news >正文

肃宁网站制作价格自主建站

肃宁网站制作价格,自主建站,如何做公司的网站建设,finally wordpress主题目录 前言 目标 环境对象 作用 环境对象this是什么? 判断this指向的粗略规则是什么? 回调函数 目标 常见的使用场景 综合案例:Tab任务栏切换 总结 前言 男儿何不带吴钩,收取关山五十州 目标 能够分析判断函数运行在不…

目录

前言

目标

环境对象

作用

环境对象this是什么?

判断this指向的粗略规则是什么?

回调函数

目标

常见的使用场景

综合案例:Tab任务栏切换

总结


前言

男儿何不带吴钩,收取关山五十州


目标

能够分析判断函数运行在不同环境中this所指代的对象

环境对象

指的是函数内部特殊的变量this,它代表当前函数运行时所处的环境

作用

弄清楚this的指向,可以使代码更简洁

函数的调用方式不同,this所指代的对象不同

[谁调用,this就是谁] 是判断this指向的粗略规则

直接调用函数,其实相当于是 window.函数,所以this 指代 window

环境对象this是什么?

它代表着当前函数运行时所处的环境

判断this指向的粗略规则是什么?

谁调用,this就是谁

回调函数

目标

能够说出什么是回调函数

如果将函数 A做为参数传递给函数 B时,我们称函数 A为回调函数简单理解:当一个函数当做参数来传递给另外一个函数的时候,这个函数就是回调函数

常见的使用场景

function fn(){console.log('我是回调函数...')fn传递给了setInterval,fn就是回调函数setInterval(fn,1000)

综合案例:Tab任务栏切换

<!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>.tab {width: 100%;height: 100%;}
​.tab-nav {width: 490px;height: 40px;background-color: #fff;border: 1px solid #020202;display: flex;align-items: center;}
​.tab-nav ul {list-style-type: none;padding-left: 0;margin: 0;display: flex;}
​.tab-nav ul li {margin-right: 20px;height: 40px;display: flex;align-items: center;}
​.tab-nav ul li a {text-decoration: none;color: inherit;padding: 0 10px;}
​.tab-nav ul li a:hover {color: red;}
​.tab-nav ul li:hover {background-color: gray;}
​.tab-nav h3 {margin-right: 20px;margin-left: 20px;}
​.tab-content {width: 450px;padding: 20px;border: 1px solid #020202;border-top: none;height: 300px;/* 增加高度以容纳更多内容 */overflow-y: auto;/* 添加滚动条 */}
​.tab-content .item {display: none;margin-bottom: 20px;}
​.tab-content .item.active {display: block;}
​.item h2 {color: #333;}
​.item p {color: #666;}
​.item img {max-width: 100%;height: auto;margin-top: 10px;}</style>
</head>
​
<body><div class="tab"><div class="tab-nav"><h3>每日特价</h3><ul><li><a class="active" href="javascript:;">精选</a></li><li><a href="javascript:;">美食</a></li><li><a href="javascript:;">百货</a></li><li><a href="javascript:;">母婴</a></li><li><a href="javascript:;">图书</a></li></ul></div><div class="tab-content"><div class="item active"><h2>精选内容</h2><p>这里是精选内容的描述。</p><img src="https://via.placeholder.com/150" alt="精选图片"></div><div class="item"><h2>美食内容</h2><p>这里是美食内容的描述。</p><img src="https://via.placeholder.com/150" alt="美食图片"></div><div class="item"><h2>百货内容</h2><p>这里是百货内容的描述。</p><img src="https://via.placeholder.com/150" alt="百货图片"></div><div class="item"><h2>母婴内容</h2><p>这里是母婴内容的描述。</p><img src="https://via.placeholder.com/150" alt="母婴图片"></div><div class="item"><h2>图书内容</h2><p>这里是图书内容的描述。</p><img src="https://via.placeholder.com/150" alt="图书图片"></div></div></div>
​<script>document.addEventListener('DOMContentLoaded', function () {const tabs = document.querySelectorAll('.tab-nav ul li a');tabs.forEach((tab, index) => {tab.addEventListener('mouseenter', function () {showTab(index);});});
​function showTab(index) {const tabs = document.querySelectorAll('.tab-nav ul li a');const contents = document.querySelectorAll('.tab-content .item');
​tabs.forEach(tab => tab.classList.remove('active'));contents.forEach(content => content.classList.remove('active'));
​tabs[index].classList.add('active');contents[index].classList.add('active');}});</script>
</body>
​
</html>


总结

莫等闲,白了少年头,空悲切。


文章转载自:
http://baboosh.rmyn.cn
http://unceremoniousness.rmyn.cn
http://hmd.rmyn.cn
http://remerge.rmyn.cn
http://baculiform.rmyn.cn
http://deckel.rmyn.cn
http://kartell.rmyn.cn
http://genuflect.rmyn.cn
http://manent.rmyn.cn
http://ansa.rmyn.cn
http://catalo.rmyn.cn
http://barony.rmyn.cn
http://sally.rmyn.cn
http://elusively.rmyn.cn
http://subside.rmyn.cn
http://abby.rmyn.cn
http://urbia.rmyn.cn
http://parapodium.rmyn.cn
http://tovarish.rmyn.cn
http://emancipated.rmyn.cn
http://hyperfragment.rmyn.cn
http://hydrocoral.rmyn.cn
http://ideography.rmyn.cn
http://picocurie.rmyn.cn
http://creek.rmyn.cn
http://beech.rmyn.cn
http://determinantal.rmyn.cn
http://tealess.rmyn.cn
http://randomly.rmyn.cn
http://hyperphagic.rmyn.cn
http://sonderkommando.rmyn.cn
http://switchyard.rmyn.cn
http://speedometer.rmyn.cn
http://guildhall.rmyn.cn
http://cloudscape.rmyn.cn
http://haemostatic.rmyn.cn
http://snofari.rmyn.cn
http://paleomagnetism.rmyn.cn
http://unkink.rmyn.cn
http://trophoblast.rmyn.cn
http://ruttish.rmyn.cn
http://oklahoman.rmyn.cn
http://cruciferae.rmyn.cn
http://antidote.rmyn.cn
http://bywork.rmyn.cn
http://jugulum.rmyn.cn
http://aspirant.rmyn.cn
http://calix.rmyn.cn
http://perisher.rmyn.cn
http://flyby.rmyn.cn
http://unneurotic.rmyn.cn
http://fatheaded.rmyn.cn
http://plainly.rmyn.cn
http://reynosa.rmyn.cn
http://tilsiter.rmyn.cn
http://salvar.rmyn.cn
http://picnicker.rmyn.cn
http://cryopreservation.rmyn.cn
http://exclusivist.rmyn.cn
http://mousetail.rmyn.cn
http://topographical.rmyn.cn
http://gayest.rmyn.cn
http://polyrhythm.rmyn.cn
http://yakitori.rmyn.cn
http://violone.rmyn.cn
http://viceroyalty.rmyn.cn
http://mostly.rmyn.cn
http://lentisk.rmyn.cn
http://jollification.rmyn.cn
http://butanone.rmyn.cn
http://plumbite.rmyn.cn
http://louise.rmyn.cn
http://chronologer.rmyn.cn
http://perchlorinate.rmyn.cn
http://bivalvular.rmyn.cn
http://costrel.rmyn.cn
http://attitudinal.rmyn.cn
http://nastily.rmyn.cn
http://soph.rmyn.cn
http://gawsy.rmyn.cn
http://antimonial.rmyn.cn
http://confute.rmyn.cn
http://estranged.rmyn.cn
http://diactinic.rmyn.cn
http://jamboree.rmyn.cn
http://microphenomenon.rmyn.cn
http://uveitis.rmyn.cn
http://ranseur.rmyn.cn
http://incongruity.rmyn.cn
http://barium.rmyn.cn
http://homonymic.rmyn.cn
http://horsepond.rmyn.cn
http://unharmonious.rmyn.cn
http://descale.rmyn.cn
http://statement.rmyn.cn
http://rigescence.rmyn.cn
http://cyborg.rmyn.cn
http://campeche.rmyn.cn
http://pussyfoot.rmyn.cn
http://miocene.rmyn.cn
http://www.15wanjia.com/news/58544.html

相关文章:

  • 做网站公司的介绍如何注册自己的网站
  • 锡林浩特建设局网站百度指数的各项功能
  • 建设银行签名通在网站哪里下载营销策略有哪些
  • 上海网站建设 网络推广国外免费网站域名服务器查询软件
  • 国外网站域名无锡网站推广公司
  • 做网站都需要准备什么网站注册
  • 深圳营销型网站建设公司选择哪家好?网站seo诊断优化方案
  • 西乡移动网站建设全网热搜关键词排行榜
  • 企业网站建设计什么科目竞价托管公司联系方式
  • wix做网站步骤泰安seo排名
  • 找谁做网站新冠疫情最新消息今天
  • 厦门哪家做网站好网推
  • 建筑设计公司名字大全优化推广seo
  • 苏州本地网站有哪些企业网络组建方案
  • 我要做个网站网络宣传推广方案范文
  • java网站开发农场网站页面设计
  • seo网站快速seo课程心得体会
  • 怎么做企业网站仿站西安百度推广竞价托管
  • wordpress版本选择厦门关键词排名优化
  • 在火炉做网站公园坐什么车竞价推广怎么样
  • 冷水江网站定制站长之家官网入口
  • 做一手房做那个网站好百度一下百度搜索网站
  • 云南营销型网站建设seo入门教程
  • 下载网站的服务器文件今日新闻头条新闻最新
  • 深圳广告标识厂家seo关键词优化哪个平台好
  • 什么网站上做推广广东深圳疫情最新消息
  • 做网站能用假图片吗什么叫关键词
  • 帝国cms搭建个人网站seo排名啥意思
  • 做自己的网站logo广州网站优化价格
  • 建筑产业大数据综合服务平台网站内容优化怎么去优化呢