一、jquery獲取當前選中select的text值
var checkText=$("#slc1").find("option:selected").text();
二、jquery獲取當前選中select的value值
var checkValue=$("#slc1").val();
三、jquery獲取當前選中select的索引值
var index=$("#slc1 ").get(0).selectedIndex;
四、jquery設置索引值爲1的項爲當前選中項
$("#slc1 ").get(0).selectedIndex=1;
五、jquery設置value值2的項爲當前選中項
$("#slc1 ").val(2);
六、jquery設置text值爲"青藤園"的項爲當前選中項
$("#slc1 option[text='青園w']").attr("selected",true);
七、爲指定select下拉框追加一個option(追加到在末尾)
$("#slc2").append(""+i+"");
八、爲制定select下拉框插入一個option(插入到第一個位置)
$("#slc2").prepend("請選擇");
九、jquery刪除select下拉框的最後一個option
$("#slc2 option:last").remove();
//Integer.parseInt(s, radix) radix設置爲10,表示10進制,16表示16進制啦
int i = Integer.parseInt(a, 16);
System.out.println(i);//輸出5488661
/* var map = {}; // Map map = new HashMap();
map[key] = value; // map.put(key, value);
var value = map[key]; // Object value = map.get(key);
var has = key in map; // boolean has = map.containsKey(key);
delete map[key]; // map.remove(key); */
#js保留小數點
var num=22.127456;
alert( num.toFixed(2));
#時間戳轉換字符串
function add0(m){return m<10?'0'+m:m }
function format(shijianchuo)
{
//shijianchuo是整數,不然要parseInt轉換
var time = new Date(shijianchuo);
var y = time.getFullYear();
var m = time.getMonth()+1;
var d = time.getDate();
var h = time.getHours();
var mm = time.getMinutes();
var s = time.getSeconds();
return y+'-'+add0(m)+'-'+add0(d)+' '+add0(h)+':'+add0(mm)+':'+add0(s);
}
#添加滾動條
$(".abckuaiconji").slimScroll({
height: "256px"
}) jquery