韩顺平javascript笔记(全套) - 百度文库

for(var i=0; i < fruits.length; i++){ fruits[i].checked=true; }

}else if(Obj.innerText==\È¡Ïû\

for(var i=0; i < fruits.length; i++){

fruits[i].checked=false; }

}

}

//ÏìÓ¦¸´Ñ¡¿ò

function selectCheck2(Obj){

var fruits = document.getElementsByName(\

if(myselect.checked){

for(var i=0; i < fruits.length; i++){ fruits[i].checked=true; }

}else {

for(var i=0; i < fruits.length; i++){

fruits[i].checked=false; }

}

} //-->

ÎҵĹºÎï³µ

**

¡ö forms¶ÔÏ󼯺Ï/form¶ÔÏó forms¶ÔÏ󼯺ÏÓÐ length : ·µ»Ø´óС

item(index) : Ö¸¶¨È¡³öfoms¶ÔÏ󼯺ϵĵڼ¸¸öform¶ÔÏó

˵Ã÷£ºµ±·ÃÎÊij¸ö±íµ¥µÄij¸öÔªËصÄʱºò£¬¿ÉÒÔ 3. document . forms[µÚ¼¸¸ö±íµ¥] . ÔªËصÄÃû×Ö 4. document . forms.item(µÚ¼¸¸ö±íµ¥). ÔªËصÄÃû×Ö ¡ö ±íµ¥µÄÒ»¸ö×ۺϰ¸Àý

´úÂ룺

×¢²á±íµ¥

function checkinfo(){ span1.innerText=\ //»ñÈ¡±íµ¥µÄÐÅÏ¢

if(document.forms[0].username.value.length <

document.forms[0].username.value.length > 6){ span1.innerText=\Óû§ÃûÓ¦ÔÚ4-6λ¼ä\

return false;//¼ÇסҪ·µ»Ø£¬²»È»ÌύˢÐÂÁ˾Ϳ´²»¼ûÁË }

//ÅжÏÃÜÂëÊÇ·ñOK

if(document.forms[0].pwd1.value.length <= 3){

4

||

span2.innerText=\ÃÜÂëÒªÇóÒª´óÓÚ3λ\ return false; }

if(document.forms[0].pwd1.value != document.forms[0].pwd2.value ){ span3.innerText=\ÊäÈëÃÜÂëÁ½´Î²»Ò»Ñù\ return false; } } //-->

Óû§×¢²á