javascript Êý×é
optionsÊý×é
¡¡¡¡¸ÃÊý×éÊÇselect¶ÔÏóµÄÒ»¸öÊôÐÔ,¼´Ñ¡Ôñ¿òÖеÄËùÓÐÑ¡Ïî(<OPTION>)µÄÒ»¸öÁÐ±í¡£
¡¡¡¡ÊôÐÔ
¡¡¡¡defaultSelected Ñ¡ÏîÁбíÖеÄȱʡѡÏî
¡¡¡¡index Ñ¡ÏîÁбíÖÐijѡÏîµÄË÷ÒýλÖÃ
¡¡¡¡length Ñ¡ÏîÁбíÖеÄÑ¡ÏîÊý(<OPTIONS>)
¡¡¡¡name Ñ¡ÏîÁбíµÄÃû×Ö(NAMEÌØÐÔ)
¡¡¡¡selected ±íʾѡÏîÁбíÖÐijѡÏî<OPTION>ÊÇ·ñ±»Ñ¡ÖеÄÒ»¸ö²¼¶ûÀàÐÍÖµ
¡¡¡¡selectedIndex Ñ¡ÏîÁбíÖÐÒÑÑ¡ÖеÄ<OPTION>µÄË÷Òý(λÖÃ)
¡¡¡¡text Ñ¡ÏîÁбíÖÐ<OPTION>±ê¼ÇºóµÄÎı¾
¡¡¡¡value Ñ¡ÏîÁбíÖеÄVALUE=ÌØÐÔ
Array Êý×é
1. var array = new Array(12,23......);//´´½¨Êý×飬³õʼ»¯Êý×éֵΪ£º12£¬13....
2. var array = new Array(12);//´´½¨Êý×飬Êý×é´óСΪ12
3. var array = new Array();//´´½¨Êý×é
for (var i = 0; i < length; i++) {
aCity[i] = new Array();//´´½¨¶þάÊý×é
}
for (var i = 0; i < length; i++) {
for (var j = 0; j < length; j++) {
aCity[i][j] = "";//¸ø¶þάÊý×鸳ֵ
aCity[i][j] = "";
}
}
Àý×Ó£º
ͨ¹ýÉùÃ÷¶þάÊý×é°ó¶¨SELECTÏÂÀ²Ëµ¥
<HTML>
<HEAD>
<TITLE>¶¯Ì¬¸Ä±äÏÂÀ²Ëµ¥ÄÚÈÝʾÀý</TITLE>
</HEAD>
<SCRIPT LANGUAGE=javascript>
//¶¨ÒåÒ»¸ö¶þάÊý×éaArray,ÓÃÓÚ´æ·Å³ÇÊÐÃû³Æ¡£
var aCity=new Array();
aCity[0]=new Array();
aCity[1]=new Array();
aCity[2]=new Array();
aCity[3]=new Array();
//¸³Öµ£¬Ã¿¸öÊ¡·ÝµÄ³ÇÊдæ·ÅÓÚÊý×éµÄÒ»ÐС£
aCity[0][0]="--ÇëÑ¡Ôñ--";
aCity[1][0]="--ÇëÑ¡Ôñ--";
aCity[1][1]="¹ãÖÝÊÐ";
aCity[1][2]="ÉîÛÚÊÐ";
aCity[1][3]="Ö麣ÊÐ";
aCity[1][4]="ÉÇÍ·ÊÐ";
aCity[1][5]="·ðɽÊÐ";
aCity[2][0]="--ÇëÑ¡Ôñ--";
aCity[2][1]="³¤É³ÊÐ";
aCity[2][2]="ÖêÖÝÊÐ";
aCity[2][3]="Ïæ̶ÊÐ";
aCity[3][0]="--ÇëÑ¡Ôñ--";
aCity[3][1]="º¼ÖÝÊÐ";
aCity[3][2]="ËÕÖÝÊÐ";
aCity[3][3]="ÎÂÖÝÊÐ";
function ChangeCity()
{
var i,iProvinceIndex;
iProvinceIndex=document.frm.optProvince.selectedIndex;
iCityCount=0;
while (aCity[iProvinceIndex][iCityCount]!=null)
iCityCount++;
//¼ÆËãÑ¡¶¨Ê¡·ÝµÄ³ÇÊиöÊý
document.frm.optCity.length=iCityCount;//¸Ä±äÏÂÀ²Ëµ¥µÄÑ¡ÏîÊý
for (i=0;i<=iCityCount-1;i
Ïà¹ØÎĵµ£º
scrollHeight: »ñÈ¡¶ÔÏóµÄ¹ö¶¯¸ß¶È¡£
scrollLeft:ÉèÖûò»ñȡλÓÚ¶ÔÏó×ó±ß½çºÍ´°¿ÚÖÐÄ¿Ç°¿É¼ûÄÚÈݵÄ×î×ó¶ËÖ®¼äµÄ¾àÀë
scrollTop:ÉèÖûò»ñȡλÓÚ¶ÔÏó×¶ËºÍ´°¿ÚÖпɼûÄÚÈݵÄ×¶ËÖ®¼äµÄ¾àÀë
scrollWidth:»ñÈ¡¶ÔÏóµÄ¹ö¶¯¿í¶È
offsetHeight:»ñÈ¡¶ÔÏóÏà¶ÔÓÚ°æÃæ»òÓɸ¸×ø±ê offsetParent ÊôÐÔÖ¸¶¨µÄ¸¸×ø±êµÄ¸ß¶È
offsetL ......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document </title>
<meta name="generator" content="edit ......
×î½ü×öË°Îñ×ÛºÏƽ̨¹¤×÷Á÷£¬ ÔÚÒ³ÃæÉÏÅжÏÊÇ·ñÊÇ“»õ±Ò½ð¶î”¸ñʽ£¬Ê¹ÓõÄÊÇÕýÔò±í´ïʽ£¬Ò»Ö±¶¼Ã»ÓÐÎÊÌ⣬
ºóÀ´Í»È»ÎÞ·¨ÑéÖ¤£¬ ¾ÍÊDz»·ûºÏÕýÔò±í´ïʽµÄ½á¹¹£¬×îºóÖÕÓÚ·¢ÏÖ ½ð¶îºóÃæ°üº¬¿Õ¸ñ×Ö·û´®£¬ÔÚÍøÉÏÕÒµ½Ò»¶Î´úÂë £¬ÕýºÃ½â¾ö¡£
String.prototype.trim= function(){
// ÓÃÕýÔò±í´ïʽ½«Ç°ºó¿ ......
µ¥Ìåģʽ
Óŵã:°Ñ´úÂë×éÖ¯µÃÒ»Ö²¢¸ôÀë,¸üÈÝÒ×ÔĶÁºÍά»¤,Ìá¸ßÎȶ¨ÐÔ;ÓÃÓÚÓÅ»¯,ÌáÉýÐÔÄÜ
ȱµã:¿Éµ¼ÖÂÇ¿ñîºÏ
5.1 µ¥ÌåµÄ»ù±¾½á¹¹
var Singleton = {
attribute1 : true,
attribute2 : 10,
method1 : function(){},
method2 : function(){}
};
Ñϸñ°´¶¨ÒåÀ´Ëµ,C1²»ÊÇÒ»¸öµ¥Ìå,ÒòΪËü²»ÊÇÒ»¸ö¿ÉʵÀ ......
optionsÊý×é
¡¡¡¡¸ÃÊý×éÊÇselect¶ÔÏóµÄÒ»¸öÊôÐÔ,¼´Ñ¡Ôñ¿òÖеÄËùÓÐÑ¡Ïî(<OPTION>)µÄÒ»¸öÁÐ±í¡£
¡¡¡¡ÊôÐÔ
¡¡¡¡defaultSelected Ñ¡ÏîÁбíÖеÄȱʡѡÏî
¡¡¡¡index Ñ¡ÏîÁбíÖÐijѡÏîµÄË÷ÒýλÖÃ
¡¡¡¡length Ñ¡ÏîÁбíÖеÄÑ¡ÏîÊý(<OPTIONS>)
¡¡¡¡name Ñ¡ÏîÁбíµÄÃû×Ö(NAMEÌØÐÔ)
¡¡¡¡selected ±íÊ¾Ñ ......