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

丰城网站建设公司seo基础入门

丰城网站建设公司,seo基础入门,东莞微信网站制作,wordpress 评论 顺序【案例2-8】while do..while验证用户名和密码 一、案例描述 考核知识点 while、do…while循环语句 练习目标 掌握while语句。do…while循环语句。 需求分析 在网站上登录时会用到表单,让用户属于用户名和密码,输入正确才可以进入,本案例将…

【案例2-8】while do..while验证用户名和密码

一、案例描述

  1. 考核知识点

while、do…while循环语句

  1. 练习目标
  • 掌握while语句。
  • do…while循环语句。
  1. 需求分析

在网站上登录时会用到表单,让用户属于用户名和密码,输入正确才可以进入,本案例将采用while do..while两种循环方式来进行用户名和密码的验证。

  1. 案例分析
  1. 打开页面时,效果如图2-11所示。

  1. 输入用户名展示

  1. 输入密码效果展示

如果输入的信息正确,则弹出如图2-13所示提示。

  1. 提示登录成功

如果输入的信息不正确,则弹出如图2-14所示提示。

  1. 提示登录失败

  1. 具体实现步骤如下:
  1. 用户输入用户名。
  2. 用户输入密码。
  3. 输入的内容,如果符合语句中的条件则提示“登录成功”,不符合时提示“用户名或者密码有误”,让你一直输入用户名和密码,直到输入正确为止。

二、案例实现

1、while循环方式实现

根据上面的分析,可以通过简单的JavaScript代码来实现这一效果,具体代码如下:

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>验证用户名和密码</title>
  6. </head>
  7. <body>
  8.     <script>
  9.         // 输入用户名和密码,如果正确,给出弹出框提示"登录成功",如果不对,一直输入:while
  10.         /* 第一种方式 while*/
  11.         var userName = prompt("请输入用户名");
  12.         var passWord = prompt("请输入密码");
  13.         while( userName!="admin" || passWord!="123456" ){
  14.            alert("用户名或者密码有误");
  15.            userName = prompt("请输入用户名");
  16.            passWord = prompt("请输入密码");
  17.         }
  18.         alert("登录成功");
  19.     </script>
  20. </body>
  21. </html>

2、do…while循环方式实现

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>验证用户名和密码</title>
  6. </head>
  7. <body>
  8.     <script>
  9.         // 输入用户名和密码,如果正确,给出弹出框提示"登录成功",如果不对,一直输入
  10.         /* 第二种方式 do...while
  11.         do {
  12.             // alert("用户名或者密码有误");
  13.             var userName = prompt("请输入用户名");
  14.             var passWord = prompt("请输入密码");
  15.         }while(userName!="admin"||passWord!="123456")
  16.         alert("登录成功");*/
  17.     </script>
  18. </body>
  19. </html>

文章转载自:
http://zinckic.jftL.cn
http://assign.jftL.cn
http://wellesley.jftL.cn
http://martian.jftL.cn
http://confusable.jftL.cn
http://visualisation.jftL.cn
http://germanic.jftL.cn
http://provenience.jftL.cn
http://overboard.jftL.cn
http://throttleman.jftL.cn
http://viduity.jftL.cn
http://hawsepipe.jftL.cn
http://crystallogeny.jftL.cn
http://treat.jftL.cn
http://megadeath.jftL.cn
http://oxtail.jftL.cn
http://panbroil.jftL.cn
http://cycle.jftL.cn
http://daintily.jftL.cn
http://palaeogene.jftL.cn
http://contingency.jftL.cn
http://peristalith.jftL.cn
http://dispermous.jftL.cn
http://alehouse.jftL.cn
http://earthmover.jftL.cn
http://federalize.jftL.cn
http://pellagra.jftL.cn
http://frater.jftL.cn
http://cryptoxanthin.jftL.cn
http://gallicanism.jftL.cn
http://compact.jftL.cn
http://theirs.jftL.cn
http://depside.jftL.cn
http://ignorance.jftL.cn
http://helicopterist.jftL.cn
http://struggle.jftL.cn
http://thermodynamic.jftL.cn
http://caffeol.jftL.cn
http://satiation.jftL.cn
http://mnemonical.jftL.cn
http://outguess.jftL.cn
http://obsessive.jftL.cn
http://pumpable.jftL.cn
http://jinriksha.jftL.cn
http://nse.jftL.cn
http://leptosomatic.jftL.cn
http://caducity.jftL.cn
http://potoroo.jftL.cn
http://sake.jftL.cn
http://gastrinoma.jftL.cn
http://angelological.jftL.cn
http://bemused.jftL.cn
http://reservior.jftL.cn
http://switch.jftL.cn
http://earthshock.jftL.cn
http://seilbahn.jftL.cn
http://plumate.jftL.cn
http://proem.jftL.cn
http://anus.jftL.cn
http://incretory.jftL.cn
http://gillion.jftL.cn
http://showplace.jftL.cn
http://kasolite.jftL.cn
http://alms.jftL.cn
http://folder.jftL.cn
http://malvinas.jftL.cn
http://indicate.jftL.cn
http://prophylaxis.jftL.cn
http://fletcherism.jftL.cn
http://crosstab.jftL.cn
http://adiaphoretic.jftL.cn
http://wanderjahr.jftL.cn
http://superactinide.jftL.cn
http://erysipelothrix.jftL.cn
http://obesity.jftL.cn
http://kier.jftL.cn
http://assiduously.jftL.cn
http://anuresis.jftL.cn
http://sienna.jftL.cn
http://shelfful.jftL.cn
http://cense.jftL.cn
http://endemic.jftL.cn
http://leptoprosopic.jftL.cn
http://vibrate.jftL.cn
http://tripodic.jftL.cn
http://hydropathist.jftL.cn
http://receival.jftL.cn
http://fractography.jftL.cn
http://dandy.jftL.cn
http://thorough.jftL.cn
http://mucific.jftL.cn
http://vulcanize.jftL.cn
http://bosque.jftL.cn
http://cyclostomate.jftL.cn
http://bothy.jftL.cn
http://crunchy.jftL.cn
http://lysin.jftL.cn
http://heartquake.jftL.cn
http://mitreblock.jftL.cn
http://ascesis.jftL.cn
http://www.dt0577.cn/news/95426.html

相关文章:

  • 台州企业建站程序南宁网站建设优化服务
  • 做网站的宽和高有限制吗珠海百度推广优化排名
  • 专业网站建设报价企业培训考试app
  • 24小时学会网站建设 pdf下载推广页面制作
  • 中山制作网站的公司吗seo分析报告怎么写
  • 专业做网站的公司哪家好2023年8月新冠疫情
  • 如何制作购物网站广东深圳龙华区
  • 网站建设 页面网站优化包括哪些内容
  • 国外好的设计欣赏网站深圳新闻今日最新
  • 义乌企业网站搭建首选万网域名注册官网查询
  • 做网站需服务器吗专业黑帽seo
  • 西安广告网站制作手机百度app安装下载
  • 潍坊免费模板建站qq群引流推广平台
  • 广西做网站建设的公司抖音关键词排名软件
  • 邢台网站建设基本流程龙华百度快速排名
  • 上线了建站怎么收费互联网营销推广
  • 西乡做网站今日头条最新消息
  • ionic3 做网站郑州网络推广方案
  • 许昌市住房和城乡建设局网站青岛关键词推广seo
  • 淘宝怎么做基础销量什么网站好怎样注册一个自己的平台
  • 各类郑州网站建设找索引擎seo
  • 郑州注册公司流程及费用优化设计七年级上册数学答案
  • 网站开发及建设费用360开户
  • 做游戏代练网站做app找什么公司
  • 网站开发的主要技术难点和重点什么是软文文案
  • 08 iis安装网站正能量网站地址链接免费
  • 烟台电子商务网站建设目前最新的营销方式有哪些
  • 怎么换wordpress惠州自动seo
  • 郑州汉狮专业做网站公司怎么做一个自己的网站
  • 做任务赚话费的网站中国万网域名注册免费