JavaScript ²Ù×÷ select
Ò»¡¢ÐÂÔöÒ»¸ö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");//»ñµÃÊ¡select
var city_sel=document.getElementById("city");//»ñµÃÊÐselect
for(var i=0;i<province_sel.options.length;i++){
if(province_sel.options[i].value=="´ÓÊý¾Ý¿â»ñÈ¡µÄÊ¡µÄÖµ"){
province_sel.options[i].selected=true;
break;
}
}
initCity("´ÓÊý¾Ý¿â»ñÈ¡µÄÊ¡µÄÖµ");//³õʼ»¯ÊÐselect
for(var i=0;i<city_sel.options.length;i++){
if(city_sel.options[i].value=="${city}"){
city_sel.options[i].selected=true;
break;
}
}
Æß¡¢´´½¨select¶¯Ì¬ÉèÖÃÑ¡ÖÐÏî
var sel=document.getElementById("other_state");
var sel_val=document.getElementById("other_media_id").innerHTML;
for(var obj in data){
var id=data[obj]["other_media_id"];
var name=data[obj]["other_media_name"];
var op=document.createElement("option");
op.setAttribute("value",id);
op.appendChild(document.createTextNode(name));
if(id==sel_val){
op.setAttribute("selected","true");
}
sel.appendChild(op);
}
Ïà¹ØÎĵµ£º
¡¾×ª¡¿http://www.cnblogs.com/chenxizhang/archive/2010/01/01/1637309.html
Èç¹ûÎÒÃÇÐèÒªÔÚjavascript·ÃÎʵ½Ò³ÃæÖж¨ÒåµÄ±äÁ¿£¬´óÖÂÊÇÈçϵÄÓï·¨
//ÕâÊÇ2010Äê1ÔÂ1ÈÕÔö¼ÓµÄ´úÂë
var ismanager = "<%= DepartManager %>";
if (ismanager == "true") {
$(" ......
JavaScriptΪº¯Êý¶ÔÏó¶¨ÒåÁËÁ½¸ö·½·¨£ºapplyºÍcall£¬ËüÃǵÄ×÷Óö¼Êǽ«º¯Êý°ó¶¨µ½ÁíÍâÒ»¸ö¶ÔÏóÉÏÈ¥ÔËÐУ¬Á½Õß½öÔÚ¶¨Òå²ÎÊýµÄ·½Ê½ÓÐËùÇø±ð£º
Function.prototype.apply(thisArg,argArray);
Function.prototype.call(thisArg[,arg1[,arg2…]]);
´Óº¯ÊýÔÐÍ¿ÉÒÔ¿´µ½£¬µÚÒ»¸ö²ÎÊý¶¼±»È¡ÃûΪthisArg£¬¼´ËùÓк¯ÊýÄÚ²¿µ ......
ÉùÃ÷:Õâ¸öÊÇÍøÉϵÄ×ÊÁÏ,²»¹ýÎÒÔںܴó³Ì¶ÈÉϽøÐÐÁË×Ô¼ºµÄ˵Ã÷½éÉÜ,Ï£Íû´ó¼Ò»áϲ»¶¿´
1.document.write("Êä³öÄÚÈÝ");ΪÊä³öÓï¾ä
2.JSÖеÄ×¢ÊÍΪµ¥ÐÐ//ºÍ¶àÐÐ/**/
3.´«Í³µÄHTMLÎĵµË³ÐòÊÇ:document->html->(head,body)
4.Ò»¸öä¯ÀÀÆ÷´°¿ÚÖеÄDOM˳ÐòÊÇ:window->(navigator,screen,history,location,docume ......
FRAMESET ±êÇ©ÊÇ FRAME ÔªËصÄÈÝÆ÷¡£
HTML Îĵµ¿É°üº¬ FRAMESET ÔªËØ»ò BODY ÔªËØÖ®Ò»£¬Á½Õß²»ÄÜͬʱʹÓá£
¿ò¼Ü½«ÍøÒ³·Ö³É¼¸¸ö¿ò´°£¬Í¬Ê±È¡µÃ¶à¸öURL¡£ÓÃ<FRAMESET> <FRAME> ¼´¿É£¬ËùÓпò¼Ü±ê¼ÇÐèÒª·ÅÔÚÒ»¸ö×ÜÆðµÄ html ÎĵµÀÕâ¸öµµ°¸Ö»¼Ç¼Á˸ÿò¼ÜÈçºÎ·Ö¸î £¬²»»áÏÔʾÈκÎ×ÊÁÏ£¬ËùÒÔ²»±Ø·ÅÈë <BODY& ......
1¡¢Ê²Ã´ÊDZհü¡¢ÒÔ¼°±Õ°üËùÉæ¼°µÄ×÷ÓÃÓòÁ´ÕâÀï¾Í²»ËµÁË¡£
2¡¢JavaScriptÀ¬»ø»ØÊÕ»úÖÆ
JavaScript²»ÐèÒªÊÖ¶¯µØÊÍ·ÅÄڴ棬ËüʹÓÃÒ»ÖÖ×Ô¶¯À¬»ø»ØÊÕ»úÖÆ£¨garbage collection£©¡£µ±Ò»¸ö¶ÔÏóÎÞÓõÄʱºò£¬¼´³ÌÐòÖÐÎÞ±äÁ¿ÒýÓÃÕâ¸ö¶ÔÏóʱ£¬¾Í»á´ÓÄÚ´æÖÐÊͷŵôÕâ¸ö±äÁ¿¡£
Code
&nb ......