javascript»ñÈ¡selectµÄֵȫ½â
»ñÈ¡ÏÔʾµÄºº×Ö
document.getElementById("bigclass").options[window.document.getElementById("bigclass").selectedIndex].text
»ñÈ¡Êý¾Ý¿âÖеÄid
window.document.getElementById("bigclass").value
»ñÈ¡select×é·ÖÅäµÄË÷Òýid
window.document.getElementById("bigclass").selectedIndex
Àý×Ó£º
<select name="bigclass" id="bigclass" onChange="javascript:updatePage2();">
<option value="" selected="selected">ajaxʵÑé</option>
<option value="4">ÎÒÊÊÒËÊйþ</option>
</select>
ʹÓÃ
document.getElementById("bigclass").options[window.document.getElementById("bigclass").selectedIndex].text
µÄ½á¹ûÊÇ£ºÎÒÊÊÒËÊйþ
ʹÓÃ
window.document.getElementById("bigclass").value
µÄ½á¹ûÊÇ£º4
ʹÓÃ
window.document.getElementById("bigclass").selectedIndex
µÄ½á¹ûÊÇ£º1
Ò»¡¢ÐÂÔöÒ»¸öoption
var sel=document.getElementById("selectµÄid");
var op=document.createElement("option");
op.value=Öµ;
op.text=ÏÔʾÎı¾;
sel.add(op);
¶þ¡¢É¾³ýÒ»¸öoption
var sel=document.getElementById("typelist");
if(sel.selectedIndex==-1)
alert("ÇëÑ¡ÖÐҪɾ³ýµÄÏî!");
for(var i=0;i<sel.options.length;i++){
if(sel.options[i].selected){
sel.options.remove(i);
break;
}
}
Èý¡¢Çå¿ÕselectµÄËùÓÐoption
var citySel=document.getElementById("selectµÄid");
citySel.options.length=0;
ËÄ¡¢»ñµÃÑ¡ÖÐÏîµÄÖµ
var citySel=document.getElementById("selectµÄid");
var selectedValue=citySel.value;
Îå¡¢»ñµÃµ±Ç°Ñ¡ÖÐÏîµÄË÷Òý
var selectedIndex=document.all.objSelect.selectedIndex;
Áù¡¢ÉèÖÃselectµÄµ±Ç°Ñ¡ÖÐÏî
·½·¨1(µ¥¸öselect)£º document.getElementById("products_type_id").selectedIndex=1;
·½·¨2(¼¶ÁªselectÈçÊ¡Êм¶Áª)£º
var province_sel=document.getElementById("province");//
Ïà¹ØÎĵµ£º
JavaScript--ÕýÔò±í´ïʽ
ÕýÔò±í´ïʽ(regular expression)¶ÔÏó°üº¬Ò»¸öÕýÔò±í´ïʽģʽ(pattern)¡£Ëü¾ßÓÐÓÃÕýÔò±í´ïʽģʽȥƥÅä»ò´úÌæÒ»¸ö´®(string)ÖÐÌض¨×Ö·û(»ò×Ö·û¼¯ºÏ)µÄÊôÐÔ(properties)ºÍ·½·¨(methods)¡£
ÕýÔò±í´ïʽ¹¹Ô캯Êý£º new RegExp("pattern"[,"flags"]);
²ÎÊý˵Ã÷£º
pattern -- Ò»¸öÕýÔò±í´ïʽÎı¾
flag ......
Code:
<!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>ÎÞ±êÌâÒ³</title>
<mce:script language="javascript" type="te ......
¸Õ¸Õ°Ý¶ÁÁË JavascriptµÄ±äÁ¿Óëdelete²Ù×÷·û ºÜÊÜÆô·¢¡£ÔÎÄֻ˵Á˽á¹û£¬Ã»¸üÉîÈëÍÆÀí×ܽáÒ»ÏÂΪʲô£¬ÒÔ¼°ÔõôÀí½âºÃÒ»µã£¬ÎÒÕâÀï²¹³ä×ܽáһϡ£
/// <reference path="http://tech.idv2.com/2008/01/09/javascript-variables-and-delete-operator/" />
/*
Óëc++²»Í¬£¬javascriptµÄdelete²»»áɾ³ ......
ÃüÃû¿Õ¼ä£¬Ò»¿´¾ÍÖªµÀÖ÷ҪĿµÄÊÇΪÁ˱ÜÃâ³åÍ»¡£ÏÂÃæ¾ÍÀ´ËµÒ»ÏÂÈçºÎ´òÔì×Ô¼ºµÄJavaScriptÃüÃû¿Õ¼ä¡£
´òÔìJavaScriptÃüÃû¿Õ¼äÆäʵºÜ¼òµ¥£¬Ö»ÐèÒª½«×Ô¼ºµÄº¯Êý¡¢¶ÔÏó¡¢±äÁ¿µÈ·ÅÔÚÒ»¸öαÃüÃû¿Õ¼äÖУ¬¼´ÓÃÒ»¸öÄäÃûº¯Êý°ü×°ÆðÀ´¡£
(function(){
function $(id){
&n ......
ͼÏñµØͼָµÄÊÇ´øÓпɵã»÷ÇøÓòµÄͼÏñ¡£
ʵÀý
¼òµ¥µÄ HTML ͼÏñÓ³Éä
±¾ÀýÑÝʾһ·ùûÓÐÌí¼Ó JavaScript µÄͼÏñÓ³Éä¡£
Ìí¼ÓÁË JavaScript µÄͼÏñÓ³Éä
±¾ÀýÑÝʾһ·ùÌí¼ÓÁË JavaScript µÄͼÏñÓ³É䣬µ±Êó±ê¸¡¶¯ÓÚij¸öÈȵãÉÏʱ£¬»áµ÷Óà JavaScript º¯ÊýÀ´ÏÔʾÈȵãËù¶ÔÓ¦µÄÐÇÇòµÄ¼ò½é¡£
JavaScript ͼÏñµØͼ
ÎÒÃÇÒѾ ......