亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

2019-6-29 我的第一個(gè)js動(dòng)效

Original 2019-06-29 23:07:15 211
abstract:<!DOCTYPE html><html><head><meta charset="UTF-8"><title>我的第一個(gè)動(dòng)效</title><style>.fu{display:block;margin-top: 20px;}button{width:80px;height:40px;bord

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>我的第一個(gè)動(dòng)效</title>

<style>

.fu{display:block;margin-top: 20px;}

button{width:80px;height:40px;border:none;background-color:#cde9ff;color:#3d5ac0;border-radius:20px;}

button:hover{background-color:#3d5ac0;color:#fff;}

.clear{clear:both;}

p{text-indent:2em;}

</style>

<script type="text/javascript">

function myradius(){

document.getElementById("myimg").style.borderRadius="20px";

}

function myzhong(){

document.getElementById("myimg").style.width="800px";

document.getElementById("myimg").style.height="auto";

}

function myxiao(){

document.getElementById("myimg").style.width="600px";

document.getElementById("myimg").style.height="auto";

}

function mymoren(){

document.getElementById("myimg").style.width="1000px";

document.getElementById("myimg").style.height="auto";

document.getElementById("myimg").style.borderRadius="0";

document.getElementById("myimg").src="http://ipnx.cn/static/images/index_banner2.jpg";

}

function myshang(){

document.getElementById("myimg").src="http://ipnx.cn/static/images/index_banner3.gif";

}

function myxia(){

document.getElementById("myimg").src="http://img.php.cn/upload/article/000/000/003/5b49b0e610f26951.jpg";

}

</script>

</head>

<body>

<div style="text-align: center;">

<div>

<button onclick="myradius()">圓角</button> 

<button onclick="myzhong()">中</button> 

<button onclick="myxiao()">小</button>

<button onclick="mymoren()">默認(rèn)</button>

</div>

<div>

<img src="http://ipnx.cn/static/images/index_banner2.jpg" alt="" id="myimg">

</div>

<div>

<button onclick="myshang()">上一張</button>

<button onclick="myxia()">下一張</button>

</div>

</div>

<div></div>

<div style="width:800px;background-color:#3d5ac0;margin:50px auto;color:#fff;padding:20px;">

<h2 style="text-align:center;">總結(jié)</h2>

<hr>

<p>1.if...else條件語(yǔ)句,只有if是可以不加花括號(hào)</p>

<p>2.for循環(huán)語(yǔ)句,初始化默認(rèn)值、循環(huán)條件和步長(zhǎng)三部分缺一不可</p>

<p>3.while循環(huán)與do while循環(huán),不知道循環(huán)次數(shù)的情況下使用,二者區(qū)別是while先看條件再執(zhí)行,do while反之且無(wú)論條件是否滿(mǎn)足必然執(zhí)行一次</p>

<p>4.switch...case語(yǔ)句是多重條件判斷語(yǔ)句,用于多個(gè)值相等的比較,break跳出循環(huán),default都不匹配執(zhí)行</p>

<p>5.字符串相關(guān)函數(shù): <br> 

[1]lenght屬性可以返回字符長(zhǎng)度 

[2]charAt返回一個(gè)字符值,是指定索引位置的值 

[3]indexOf指出子字符串的開(kāi)始位置

[4]lastIndexOf指出最后一個(gè)子字符串的開(kāi)始位置 

[5]substring(開(kāi)始下標(biāo),結(jié)束)返回一個(gè)子字符串

[6]replace(要被替換的字符串,需要被替換成字符串):字符串替換函數(shù)

[7]concat可以連接倆兩個(gè)或者多個(gè)字符串;

[8]substr(起始位置,長(zhǎng)度)返回一個(gè)子字符串</p>

<p>類(lèi)型轉(zhuǎn)換函數(shù)

[1]string-0,字符串

[2]number.toString()

[3]parseInt(string)忽略非數(shù)字部分,從第一個(gè)字符開(kāi)始找,找到非數(shù)字截止,只取整數(shù)部分,忽略小數(shù)

[4]parseFloat(string)把小數(shù)部分也取到

[5]number+""添加空字符串方法

</p>

<p>6.創(chuàng)建數(shù)組:var a=new Array(),var a=['php','html','web'],var a=Array(1,2,3,4……n);</p>

<p>7.concat()數(shù)組合并函數(shù),join()將數(shù)組元素變成字符串,并且以指定分割符號(hào)分割,reverse()數(shù)組元素逆向排序,sort()數(shù)組元素按照一定規(guī)則排序(ASCLL字符順序),splice()刪除元素并向數(shù)組添加新元素,slice(起始位置,end)從數(shù)組中返回選定的元素,push()向數(shù)組末尾添加一個(gè)或者多個(gè)元素,并返回一個(gè)新數(shù)組的長(zhǎng)度,pop() 刪除并且返回?cái)?shù)組的最后一個(gè)元素</p>

<p>8.系統(tǒng)函數(shù)(js的內(nèi)置函數(shù),可以直接拿過(guò)來(lái)使用的,自定義函數(shù):自己創(chuàng)建的有特定功能的函數(shù),function 函數(shù)名(參數(shù)1,參數(shù)2,……){函數(shù)體}</p>

<p>9.局部變量:在JavaScript函數(shù)內(nèi)部聲明,只能在函數(shù)體內(nèi)部訪(fǎng)問(wèn)它;全局變量:在函數(shù)外聲明的變量是全局變量(網(wǎng)頁(yè)上所有的函數(shù)和腳本都可以使用)函數(shù)體外部的變量在函數(shù)外部使用</p>

<p>10.onfocus元素獲得焦點(diǎn),onblur元素失去焦點(diǎn),onchange域的內(nèi)容被改變,onclick當(dāng)用戶(hù)點(diǎn)擊某個(gè)對(duì)象時(shí)調(diào)用的事件句柄,ondblclick當(dāng)用戶(hù)雙擊某個(gè)對(duì)象時(shí)調(diào)用的事件句柄,onkeydown某個(gè)鍵盤(pán)按鍵被按下,onkeyup某個(gè)鍵盤(pán)按鍵被松開(kāi),onkeypress某個(gè)鍵盤(pán)按鍵被按下并松開(kāi),onload一張頁(yè)面或一幅圖像完成加載,onmousedown鼠標(biāo)按鈕被按下,onmousemove鼠標(biāo)被移動(dòng),onmouseout鼠標(biāo)從某元素移開(kāi),onmouseover鼠標(biāo)移到某元素之上,onmouseup鼠標(biāo)按鍵被松開(kāi),onsubmit確認(rèn)按鈕被點(diǎn)擊。</p>

</div>

</body>

</html>


Correcting teacher:天蓬老師Correction time:2019-07-01 17:38:46
Teacher's summary:總結(jié)寫(xiě)得不錯(cuò), 就差一個(gè)實(shí)戰(zhàn)了

Release Notes

Popular Entries