javaee分校課件day04-javascript與dom筆記_第1頁
javaee分校課件day04-javascript與dom筆記_第2頁
javaee分校課件day04-javascript與dom筆記_第3頁
javaee分校課件day04-javascript與dom筆記_第4頁
已閱讀5頁,還剩7頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、Javascript-隨機浮動練Javascript 是可以操作頁面上元素 cssJavascript-隨機浮動練Javascript 是可以操作頁面上元素 css分析widthheight,css的位置可以通過 Math.random()來獲取隨機坐標(biāo)通過erval()練習(xí) 2-左移與右移操功能實現(xiàn)分析xml dom ementsByTagNameselect功能實現(xiàn)分析xml dom ementsByTagNameselect。htmldomselect optionsselectedselectoptionselectedIndex可以通過xmldom的appendChildselect

2、元素的dom 的add!DOCTYPEmetahttp-equiv=keywordsmetahttp-equiv=descriptioncontent=thisismymetahttp-equiv=content-typecontent=text/html;charset=UTF-scriptfunctionmoveRightOnly() /1.id=leftid=rightvar ement = var ement = /2.select/2.1得到ement下的所有options元/varops= varops=ement.options;/htmlvarindex = varopopsi

3、ndex;/options/3.selectement.appendChild(op);/xmlement.add(op);/htmlfunctionmoveRightMany() /1.id=leftid=rightement var ement /2.獲取左邊select/2.1 select ement var ement /2.獲取左邊select/2.1 select option varops=/2.2 selectoptionselected屬性來判for(var /3.select移動了元素后,剩下的元素還可以被判斷到tableselectid=leftmultiple=mul

4、tipleinputtype=buttonvalue=input type=button value=selectid=rightmultiple=multiplevar 練習(xí) 3-完成關(guān)于購物品操需求點擊加的按鈕將數(shù)量2:怎樣獲取庫存 這段代碼獲取的是 txt.parentNode.nextSibling.nextSibling練習(xí) 3-完成關(guān)于購物品操需求點擊加的按鈕將數(shù)量2:怎樣獲取庫存 這段代碼獲取的是 txt.parentNode.nextSibling.nextSibling頁面后,會生成一個而trparentNode數(shù)字文本原理:0-9 keyCode2:ie擴展:ie與fire

5、foxie瀏覽器下獲也能鍵碼值 firefox 瀏覽器下使用的是 在Ie瀏覽ie擴展:ie與firefoxie瀏覽器下獲也能鍵碼值 firefox 瀏覽器下使用的是 在Ie瀏覽器Firefox默認行練習(xí) 4-省市二級聯(lián)xmlXml的數(shù)據(jù)在xml文件問題:xml function問題:xml functionloadXml(filename) var xmlDoc;tryernetxmlDoc=new catch (e) try/Firefox,Mozilla,Opera,xmlDoc(, catch (e) tryxmlDoc.async = false; catch (e) return!D

6、OCTYPEmetahttp-equiv=keywordsmetahttp-equiv=descriptioncontent=thisismymetahttp-equiv=content-typecontent=text/html;charset=UTF-!DOCTYPEmetahttp-equiv=keywordsmetahttp-equiv=descriptioncontent=thisismymetahttp-equiv=content-typecontent=text/html;charset=UTF- scriptvar /1.當(dāng)頁面加載完成后,調(diào)用loadXml方法得到xml文件對

7、象.window.onload=function()varprovinceElementementById(province);/得到省份下拉/2.得到xml文件對象doc= /3.xmldomvarps =for( var i =0; i ps.length;i+) 的name屬性varpname=/5.optiontextoptionid=province中varop op.text =functionfun()/1.varprovinceElementvarcityElementementById(city);/得到城市下拉varpname=/2.使用pname 在source.xml

8、文件中查找出對應(yīng)的城varpname=/2.使用pname 在source.xml 文件中查找出對應(yīng)的城市信varps =/3.遍歷ps,得到所有的for( var i =0; i ps.length;i+) 的name屬性varprovincename= /5.使用pname與provincename 對比,得到對應(yīng)的var for(var var Child.nodeValue;/得到城市名/創(chuàng)建一個varop /設(shè)置optiontext 值為op.text=/將optioncity selectid=province練習(xí)5-表單校用戶名長度必須6 位以/s*$/ test()方練習(xí)5-表

9、單校用戶名長度必須6 位以/s*$/ test()方法來判郵箱格式 6對于表單提交時需要進行校驗onsubmit 來進行校注意form !DOCTYPEmetahttp-equiv=keywordsmetahttp-equiv=descriptioncontent=thisismymetahttp-equiv=content-typecontent=text/html;charset=UTF-script function checkForm() select/1.1 得到郵對 Element /1.2 var reg/0/1.3 判斷郵箱不為alert(郵箱/1.1 得到郵對 Element

10、 /1.2 var reg/0/1.3 判斷郵箱不為alert(郵箱不能為空returnreturn/span /驗一 function var var 次輸不一致returnreturn / function 對varfieldElement /1.2 var reg/6 /1.3 判斷是不符合規(guī)ementById(repassword_msg).innerHTML= color=red+fieldName+長度必須 6 位以上returnreturn function color=red+fieldName+長度必須 6 位以上returnreturn function var reg= /(w)+(w)+(.w+)+$/; /郵箱正則格式的正/3.return_msg).innerHTML=+fieldName+

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論