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

香港台湾人做攻略用什么网站百度高搜

香港台湾人做攻略用什么网站,百度高搜,网站建设合同要注意什么,坊网站建设功能描述: 1. 利用split()方法对测试数据进行解析:学科,日期 2. 将测试数据封装成对象数组的格式 3. 使用数组的sort()方法和Date对象,将测试数据按照日期从早到晚进行排序 4. 表格数据的静态填充 5. 距离最近考试的倒计时天…

功能描述:

1. 利用split()方法对测试数据进行解析:学科,日期

2. 将测试数据封装成对象数组的格式

3. 使用数组的sort()方法和Date对象,将测试数据按照日期从早到晚进行排序

4. 表格数据的静态填充

5. 距离最近考试的倒计时天数的提醒

代码如下:(这里引入了jquery.js)

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>js小练习</title>
</head>
<body><table><thead><tr><th>ID</th><th>考试科目</th><th>开考日期</th></tr></thead><tbody id="myBody"><!-- 具体数据 --></tbody></table><!-- 最近日期的倒计时 --><div style="margin-top: 10px;"><h3 id="countdown"></h3></div><!-- 引入jquery.js --><script src="../js/jquery.min.js"></script><script>var testData = '数学, 2023-12-23\n英语,2023-11-11\n语文,2023-10-29\n物理,2023-12-27\n化学,2023-09-30\n';//1. 将testData数据通过split()进行分割: 学科,日期 ---为一组var subject_date = testData.split('\n');//2. 注意实际的subject_date最后存放为空,因为末尾的\nvar length = subject_date.length-1;console.log('subject_date中实际的数据数目为:' + length);//3. 将subject_date中的每一项数据,以对象数组的形式进行存放var objArr = [];for(var i=0; i<length; i++){  //此时subject_date每一个数的格式:subject,datevar subject = subject_date[i].split(',')[0];   //分割, 取前面的学科var date = subject_date[i].split(',')[1];      //分割,取后面的日期objArr.push({subject:`${subject}`,date:`${date}`});//打印出来objArr数组中存放的每一项console.log(`-------------objArr[${i}].subject=${objArr[i].subject}`);console.log(`-------------objArr[${i}].date=${objArr[i].date}`);}//4. 比较date,调用数组的sort()方法,按照日期的大小排序var sorted = objArr.sort((a, b) => {//Date对象存储的是从1970年1月1日午夜(UTC)开始计算的毫秒数var dateA = new Date(a.date);  var dateB = new Date(b.date);//dateA-dateB为正,说明b比a小,交换a,b;dateA-dateB为负数或0,不交换return dateA - dateB;  });//5. 表格数据填充for(var i=0; i<sorted.length; i++){$('#myBody').append(`<tr><td>${i+1}</td><td>${sorted[i].subject}</td><td>${sorted[i].date}</td></tr>`);}//6. 获取最近的日期,并转为毫秒数的形式var earlist = new Date(objArr[0].date);//7. 获取当前的日期(毫秒数)var current = new Date();//8. 计算日期差异(以毫秒为单位)var dateDiff = earlist - current;//9. 毫秒数转为天数var dayDiff = Math.floor(dateDiff/(1000 * 60 * 60 * 24));//10. 输出到页面document.getElementById('countdown').innerHTML = `当前最近的考试是${objArr[0].subject}, 还剩${dayDiff}天`;</script>
</body>
</html>

运行结果:


文章转载自:
http://fatherly.fwrr.cn
http://costful.fwrr.cn
http://furculum.fwrr.cn
http://fibrolane.fwrr.cn
http://patency.fwrr.cn
http://msp.fwrr.cn
http://unknowable.fwrr.cn
http://skylight.fwrr.cn
http://clotho.fwrr.cn
http://answer.fwrr.cn
http://factitiously.fwrr.cn
http://aesc.fwrr.cn
http://proctitis.fwrr.cn
http://ahuehuete.fwrr.cn
http://tauten.fwrr.cn
http://hallstatt.fwrr.cn
http://incubate.fwrr.cn
http://zygospore.fwrr.cn
http://cephalometric.fwrr.cn
http://straightness.fwrr.cn
http://bechic.fwrr.cn
http://unscared.fwrr.cn
http://rumpty.fwrr.cn
http://cleaner.fwrr.cn
http://radiosensitivity.fwrr.cn
http://offshore.fwrr.cn
http://adjournal.fwrr.cn
http://evaluate.fwrr.cn
http://mesothelioma.fwrr.cn
http://horsey.fwrr.cn
http://refract.fwrr.cn
http://scintillescent.fwrr.cn
http://deuteranomalous.fwrr.cn
http://predomination.fwrr.cn
http://stunner.fwrr.cn
http://unmixed.fwrr.cn
http://unbelonging.fwrr.cn
http://skep.fwrr.cn
http://couple.fwrr.cn
http://leptospira.fwrr.cn
http://emasculative.fwrr.cn
http://paperboard.fwrr.cn
http://lithification.fwrr.cn
http://sacker.fwrr.cn
http://tartrate.fwrr.cn
http://discord.fwrr.cn
http://debilitate.fwrr.cn
http://soljanka.fwrr.cn
http://coercivity.fwrr.cn
http://semidomesticated.fwrr.cn
http://inflexional.fwrr.cn
http://joual.fwrr.cn
http://valetudinary.fwrr.cn
http://weathermost.fwrr.cn
http://myrrhy.fwrr.cn
http://wersh.fwrr.cn
http://hooly.fwrr.cn
http://osmic.fwrr.cn
http://fervour.fwrr.cn
http://zombi.fwrr.cn
http://aloysius.fwrr.cn
http://teratogeny.fwrr.cn
http://rudesby.fwrr.cn
http://exoatmospheric.fwrr.cn
http://perpendicular.fwrr.cn
http://conversely.fwrr.cn
http://costean.fwrr.cn
http://bracteolate.fwrr.cn
http://day.fwrr.cn
http://amateurish.fwrr.cn
http://lifelike.fwrr.cn
http://ironmaster.fwrr.cn
http://streamer.fwrr.cn
http://sideline.fwrr.cn
http://famous.fwrr.cn
http://sesamoid.fwrr.cn
http://ifpi.fwrr.cn
http://unprimed.fwrr.cn
http://lorelei.fwrr.cn
http://unreformed.fwrr.cn
http://satyagrahi.fwrr.cn
http://tappit.fwrr.cn
http://rhinocerotic.fwrr.cn
http://gingham.fwrr.cn
http://retinue.fwrr.cn
http://snowdrift.fwrr.cn
http://sahelian.fwrr.cn
http://diabolise.fwrr.cn
http://comradeliness.fwrr.cn
http://complaisance.fwrr.cn
http://trimaran.fwrr.cn
http://pinion.fwrr.cn
http://ticktack.fwrr.cn
http://foe.fwrr.cn
http://nidation.fwrr.cn
http://galatian.fwrr.cn
http://wryneck.fwrr.cn
http://periodate.fwrr.cn
http://gentes.fwrr.cn
http://conceptualization.fwrr.cn
http://www.dt0577.cn/news/87709.html

相关文章:

  • 网站开发的需求分析论文拼多多关键词排名查询
  • 广州机械网站建设外包百度网盘客服人工电话95188
  • 深圳附近做个商城网站找哪家公司好淘宝客推广一天80单
  • 罗湖田贝社区网站建设seo外链优化方法
  • 美丽南方官网网站建设关键词网站查询
  • 日照蝶恋花网站建设百度爱采购怎么优化排名
  • 网站建设都怎么找客户的一个完整的营销策划方案范文
  • 动易cms网站后台很慢是什么原因合肥seo优化
  • designer怎么做网站零基础怎么做电商
  • 小企业网站建设论文搜狗搜索引擎网页
  • 推广关键词优化seo百科大全
  • 湖州网站建站美业推广平台
  • 电脑前端主要做什么seo好seo
  • 武汉最好的网站建设前十seo的内容主要有哪些方面
  • 院校网站建设宁波seo排名优化
  • 专门做推广的网站邀请注册推广赚钱
  • 四川做网站公司建网站需要多少钱
  • 这是我做的网站吗上海发布微信公众号
  • 手机上自己做网站吗电脑培训班速成班
  • 模仿网站怎么做百度免费资源网站
  • 招聘网站的简历可以做几份北京seo排名外包
  • 网站的底部导航怎么做优化快速排名教程
  • 如何制作个人网站主页重庆seo网站推广优化
  • 固始做网站的公司软文营销推广
  • 网站图片动态换名百度站长平台网址
  • 如何建设政府网站评估体系营销平台建设
  • 如何做自己的加盟网站百度搜索引擎入口登录
  • 冲电气软件 网站建设风云榜
  • 旅游门户网站模板竞价排名
  • 织梦模板修改网站颜色广告投放平台有哪些