selectÔªËØjavascript³£ÓòÙ×÷
*------------------------------------------------------
*˵Ã÷£ºselectÔªËØjavascript³£ÓòÙ×÷
* 1.ÅжÏÊÇ·ñ´æÔÚÖ¸¶¨valueµÄItem
* 2.¼ÓÈëÒ»¸öItem
* 3.ɾ³ýֵΪvalueµÄËùÓÐItem
* 4.ɾ³ýijһ¸öindexµÄÑ¡Ïî
* 5.¸üеÚindexÏîµÄvalueºÍtext
* 6.ÉèÖÃselectÖÐÖ¸¶¨textµÄµÚÒ»¸öItemΪѡÖÐ
* 7.ÉèÖÃselectÖÐÖ¸¶¨valueµÄµÚÒ»¸öItemΪѡÖÐ
* 8.µÃµ½µ±Ç°Ñ¡ÖÐÏîµÄvalue
* 9.µÃµ½µ±Ç°Ñ¡ÖÐÏîµÄindex
* 10.µÃµ½µ±Ç°Ñ¡ÖÐÏîµÄtext
* 11.Çå¿ÕËùÓÐÑ¡Ïî
-------------------------------------------------------*/
//1.ÅжÏÊÇ·ñ´æÔÚÖ¸¶¨valueµÄItem
function ExistValue(obj,value){
for(var i=0;i<obj.options.length;i++){
if(obj.options[i].value == value){
return true;
}
}
return false;
}
//2.¼ÓÈëÒ»¸öItem
function AddItem(obj,text,value){
var varItem = new Option(text,value);
obj.options.add(varItem);
}
//3.ɾ³ýֵΪvalueµÄËùÓÐItem
function RemoveItems(obj,value){
for(var i=0;i<obj.options.length;i++){
if(obj.options[i].value == value){
obj.remove(i);
}
}
}
//4.ɾ³ýijһ¸öindexµÄÑ¡Ïî
function Remo
Ïà¹ØÎĵµ£º
<!---------<html>
<head>
<style type="text/css">
.tabheader table {
border-collapse: collapse; /* for IE */
border-spacing: 0; /* for N6 */
}
.tabheader table tr td {mar ......
ÔÚһЩ´«Í³µÄСÐÍWEBÓ¦Óÿª·¢¹ý³ÌÖУ¬JavaScriptͨ³£Ö»ÊÇÄÃÀ´×ö±íµ¥ÑéÖ¤¶øÒÔ£¬ËùÒÔÄãºÜÉÙ»áÓöµ½ÒòΪJavaScriptʼþðÅݶøÓ°Ï칦ÄܵÄʵÏÖÇé¿ö£¬ÓÖ»òÕßʼþðÅݶÔ×îÖÕʵÏÖЧ¹ûÓ°Ïì²»´ó£¬¿ÉºöÂÔ¡£È»¶ø£¬ÔÚ½ñÌìһЩ´óÐ͵ÄWEB½»»¥ÏîÄ¿ÖУ¬±ÈÈç´óÐ͵ÄWebGameÏîÄ¿£¬JavaScriptʼþðÅÝÓ°ÏìÊÇÖµµÃÖØÊӵġ£±¾ÎÄͨ¹ýÒ»¸ö¼òµ¥µÄÀý×ÓÀ´½ ......
JavaScript±í¸ñÅÅÐòÓкܶàÖÖ·½Ê½£¬²»¹ýÔÚʹÓÃÃæÏò¶ÔÏóµÄ·½Ê½½øÐÐJavaScriptÅÅÐòʱIE»áÓÐһЩÎÊÌâ¡£´úÂëÈçÏ£º
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ÑÝʾ±í¸ñµÄÅÅÐò¹¦ÄÜ</title>
</head>
< ......
Õâ¸öµØ·½¾ÍÊÇΪʲôËüµÄStringÀàÐͲ»Ö±½ÓÌṩһ¸ötrim·½·¨ÄØ£¿
Ϊʲôÿ´Î¶¼ÒªÐ´ÕâÑùÒ»¾ä»°ÄØ£¿
String.prototype.trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"");}
ÕâÑùÓÐÒâ˼Âð£¿
JavaScriptÖй涨һ¸öÕâÑùµÄ·½·¨»áËÀ°¡£¿ ......