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");//
Ïà¹ØÎĵµ£º
½üÀ´¿´ÁËDeanµÄ“Convert any colour value to hex in MSIE”£¬ÖÕÓÚ½â¾öÁ˸ù¾Ý¹Ø¼ü×Ö»ñÈ¡ÑÕÉ«rgbÖµµÄÎÊÌâ¡£
˳±ã°Ñ³ÌÐòÒ²ÖØÐÂÕûÀíÒ»·¬£¬²¢Ê¹ÓÃÁË×î½üÕûÀíµÄ¹¤¾ß¿â¡£
Ч¹ûÔ¤ÀÀµ½ÕâÀï
ÏÂÔØÍêÕûʵÀý
³ÌÐò˵Ã÷
¡¾ColorGradsÑÕÉ«Ìݶȡ¿
³ÌÐòColorGradsµÄ×÷ÓÃÊǸù¾ÝÑÕÉ«¼¯ºÏºÍ½¥±ä¼¶ÊýÉú³ÉÑÕÉ«Ìݶȼ¯ºÏ¡£
½¥±ä¼ ......
JavascriptÖÐ×î³£ÓõÄ55¸ö¾µä¼¼ÇÉ ÊÕ²Ø
1. oncontextmenu="window.event.returnValue=false" ½«³¹µ×ÆÁ±ÎÊó±êÓÒ¼ü
<table border oncontextmenu=return(false)><td>no</table> ¿ÉÓÃÓÚTable
2. <body onselectstart="return false"> È¡ÏûÑ¡È¡¡¢·ÀÖ¹¸´ÖÆ
3. onpaste="return false" ²»×¼Õ³Ìù
4 ......
function sAlert(msg,boxtype,func,msgtitle)
sAlert('ÐÅÏ¢ÄÚÈÝ',1,'','ÐÅÏ¢±êÌâ')
@msg:ÌáʾÐÅÏ¢ÄÚÈÝ
@boxtype£º1Ϊµ¯³ö¿ò£¬2ΪȷÈÏ¿ò£¬3ΪÌáʾ¿ò
@func:µãÈ·ÈÏʱִÐеĺ¯Êý
@title:ÐÅÏ¢¿ò±êÌâÎÄ×ÖÄÚÈÝ
Ö»ÓÐmsgÊDZØÐëµÄ£¬ºóÃæµÄ²ÎÊý¿ÉÒÔÊ¡ÂÔ¡£Èç¹ûÖмäµÄ²ÎÊýΪ¿ÕÔòÔÚ¶ÔӦλÖÃÉÏ''»òÕß""±íʾ£¨¸ù¾Ýʵ¼ÊÇé¿öÑ¡Ôñµ ......
ͼÏñµØͼָµÄÊÇ´øÓпɵã»÷ÇøÓòµÄͼÏñ¡£
ʵÀý
¼òµ¥µÄ HTML ͼÏñÓ³Éä
±¾ÀýÑÝʾһ·ùûÓÐÌí¼Ó JavaScript µÄͼÏñÓ³Éä¡£
Ìí¼ÓÁË JavaScript µÄͼÏñÓ³Éä
±¾ÀýÑÝʾһ·ùÌí¼ÓÁË JavaScript µÄͼÏñÓ³É䣬µ±Êó±ê¸¡¶¯ÓÚij¸öÈȵãÉÏʱ£¬»áµ÷Óà JavaScript º¯ÊýÀ´ÏÔʾÈȵãËù¶ÔÓ¦µÄÐÇÇòµÄ¼ò½é¡£
JavaScript ͼÏñµØͼ
ÎÒÃÇÒѾ ......
//ÅжÏÊäÈëÄÚÈÝÊÇ·ñΪ¿Õ
function IsNull(){
var str = document.getElementById('str').value.trim();
if(str.length==0){
alert('¶Ô²»Æð£¬Îı¾¿ò²»ÄÜΪ¿Õ»òÕßΪ¿Õ¸ñ!');//Ç뽫“Îı¾¿ò”¸Ä³ÉÄãÐèÒªÑéÖ¤µÄÊôÐÔÃû³Æ!
}
}
//ÅжÏÈÕÆÚÀàÐÍÊÇ·ñÎ ......