1.
成都創(chuàng)新互聯(lián)公司自2013年創(chuàng)立以來(lái),是專(zhuān)業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目網(wǎng)站建設(shè)、網(wǎng)站制作網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢(mèng)想脫穎而出為使命,1280元高淳做網(wǎng)站,已為上家服務(wù),為高淳各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話:18980820575
for(var i=1000;i=9999;i++){
if(i%13==0){
var n2 = Math.floor(i/10)%10;
var n3 = Math.floor(i/100)%10;
var n4 = Math.floor(i/1000);
if(n2+n3==n4)
console.log("滿足條件的數(shù)為:"+i);
}
}
2.
var sum = 0, start = 1, end=0, n=1;
while(start 500) {
for(n = start; sum 1000; n++) {
sum += n;
if(sum == 1000) {
end=n;
console.log("連續(xù)相加為1000的連續(xù)正整數(shù)為:"+start+"到"+end);
}
}
start++;
sum = 0;
}
因?yàn)樯獠缓谩?/p>
js訓(xùn)練是以參與式教學(xué)法訓(xùn)練您掌握成功者應(yīng)具備的基本素質(zhì)和八類(lèi)能力。結(jié)業(yè)考試采用開(kāi)卷考試形式并結(jié)合日常作業(yè)評(píng)定分?jǐn)?shù)。為保證學(xué)有所成,學(xué)員還可通過(guò)JS訓(xùn)練特別設(shè)計(jì)的自我訓(xùn)練程序的八個(gè)訓(xùn)練環(huán)強(qiáng)化綜合實(shí)踐能力并通過(guò)16個(gè)成功鏈自我檢驗(yàn)訓(xùn)練效果。
登陸頁(yè)面 login.html
!doctype?html
html?lang="en"
head
meta?charset="UTF-8"
titlelogin/title
link?rel="stylesheet"?href="all.css"
script?src="validate.js"/script
script?src="login.js"/script
/head
body
div?class="x-stage"
form?action="#"?class="x-form"
div?class="x-field"label?for="e-username"?class="x-label"用戶名:/labelinput?id="e-username"?name?=?"username"?type="text"?class="x-input"http://div
div?class="x-field"label?for="e-pwd"?class="x-label"密碼:/labelinput?id="e-pwd"?name="pwd"?type="password"?class="x-input"http://div
input?type="button"?name="login"?value="登陸"/
input?type="button"?name="regist"?value="注冊(cè)"/
/form
/div
/body
/html
注冊(cè)頁(yè)面 regist.html
!doctype?html
html?lang="en"
head
meta?charset="UTF-8"
titleregist/title
link?rel="stylesheet"?href="all.css"
script?src="validate.js"/script
script?src="regist.js"/script
/head
body
div?class="x-stage"
form?action="#"?class="x-form"
div?class="x-field"font?class="x-requirement"*/fontlabel?for="e-username"?class="x-label"用戶名:/labelinput?id="e-username"?name?=?"username"?type="text"?class="x-input"/div?class="x-prompt"2-10位字符?數(shù)字和字母均可/div/div
div?class="x-field"font?class="x-requirement"*/fontlabel?for="e-pwd"?class="x-label"密碼:/labelinput?id="e-pwd"?name="pwd"?type="password"?class="x-input"/div?class="x-prompt"6-20位?可以是數(shù)字字母或下劃線/div/div
div?class="x-field"font?class="x-requirement"*/fontlabel?for="e-c-pwd"?class="x-label"確認(rèn)密碼:/labelinput?id="e-c-pwd"?name="cPwd"?type="password"?class="x-input"/div?class="x-prompt"/div/div
div?class="x-field"font?class="x-requirement"*/fontlabel?for="e-mail"?class="x-label"電子郵箱:/labelinput?id="e-mail"?name="mail"?type="text"?class="x-input"/div?class="x-prompt"用于驗(yàn)證和找回密碼/div/div
div?class="x-field"font?class="x-requirement"*/fontlabel?for="e-sex-man"?class="x-label"性別:/labelinput?id="e-sex-man"?name="sex"?type="radio"?class="x-input"男/inputinput?id="e-sex-woman"?name="sex"?type="radio"?class="x-input"女/inputdiv?class="x-prompt"/div/div
input?type="button"?name="regist"?value="注冊(cè)"/
/form
/div
/body
/html
登陸腳本 login.js
window.onload?=?function(){
var?form?=?document.forms[0];
var?lastWorkUrl?=?'';
form.regist.onclick?=?function(){
form.action?=?'regist.html';
form.submit();
};
form.login.onclick?=?function(){
if(!validate.checkLogin(form.username.value,form.pwd.value))
return?false;
form.action?=?lastWorkUrl;
form.submit();
};
}
注冊(cè)腳本 regist.js
window.onload?=?function(){
var?form?=?document.forms[0];
var?lastWorkUrl?=?'';
form.regist.onclick?=?function(){
if(?!validate.checkUserName(form.username.value)
||?!validate.checkPwd(form.pwd.value)
||?!validate.checkConfirmPwd(form.pwd.value,form.cPwd.value)
||?!validate.checkMail(form.mail.value))
return?false;
form.action?=?lastWorkUrl;
form.submit();
};
}
驗(yàn)證腳本 validate.js
var?validate?=?{
checkNull:function(value){
if(!value)?
return?alert('不能為空!'),false;
return?true;
},
checkLogin:function(name,pwd){
if(!name?||?!pwd)
return?alert('輸入不正確!'),false;
return?true;
},
checkUserName:function(value){
if(!this.checkNull(value))
return?false;
if(!/^[A-Za-z0-9]{2,10}$/.test(value))
return?alert('2-10位字符?數(shù)字字母均可!'),false;
return?true;
},
checkPwd:function(value){
if(!this.checkNull(value))
return?false;
if(!/^\w{6,20}$/.test(value))
return?alert('6-20位?可以是數(shù)字字母或下劃線!'),false;
return?true;
},
checkConfirmPwd:function(pwd,cpwd){
if(pwd??pwd?==?cpwd??this.checkPwd(pwd)??this.checkPwd(cpwd))
return?true;
return?alert('確認(rèn)密碼錯(cuò)誤!'),false;
},
checkMail:function(value){
if(!this.checkNull(value))
return?false;
if(!/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(value))
return?alert('郵箱格式錯(cuò)誤!'),false;
return?true;
}
};
樣式表 all.css
.x-stage{
width:400px;
margin:100px?auto;
}
.x-form{
}
.x-field{
margin-bottom:?5px;
font-size:?12px;
}
.x-label{
font-weight:?bold;
margin-right:?5px;
width:?60px;
display:?inline-block;
vertical-align:?middle;
}
.x-input{
outline:none;
vertical-align:?middle;
}
.x-prompt{
color?:?red;
font-size:?12px;
margin:?5px?0?5px?70px;
}
.x-requirement{
color?:?red;
}
當(dāng)前題目:javascript訓(xùn)練,javascript學(xué)習(xí)指南
鏈接地址:http://chinadenli.net/article2/dsdsiic.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供虛擬主機(jī)、小程序開(kāi)發(fā)、網(wǎng)站制作、建站公司、網(wǎng)站策劃、品牌網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)