亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

jquery 使用點滴函數代碼

 更新時間:2011年05月20日 01:30:47   作者:  
簡單的按鈕js事件 用于判斷和顯示提示
1、簡單的按鈕js事件 用于判斷和顯示提示
復制代碼 代碼如下:

<script type="text/javascript" language="javascript">
$(document).ready(function () {
$("#btnlogin").click(function () {
$("#lblInfo").html("");
var uid = $.trim($("#txtUsername").val());
var pwd = $.trim($("#txtPassword").val());
if (uid == "") {
$("#lblInfo").html("賬號不能為空");
$("#txtUsername").focus();
return false;
}
if (pwd == "") {
$("#lblInfo").html("密碼不能為空");
$("#txtPassword").focus();
return false;
}
});
});
</script>


2、下拉列表的處理
復制代碼 代碼如下:

function dropTypeChange()
{
var sel = $("#<%=dropType.ClientID %> option:selected").val();
if(sel=="-1")
{
$("#<%=txtNo.ClientID %>").attr('disabled',true);
}
else
{
$("#<%=txtNo.ClientID %>").attr('disabled',false);
}
}


//獲取第一個option的值
$('#test option:first').val();
//最后一個option的值
$('#test option:last').val();
//獲取第二個option的值
$('#test option:eq(1)').val();
//獲取選中的值
$('#test').val();
$('#test option:selected').val();
//設置值為2的option為選中狀態(tài)
$('#test').attr('value','2');
//設置第一個option為選中
$('#test option:last').attr('selected','selected');
$("#test").attr('value' , $('#test option:last').val());
$("#test").attr('value' , $('#test option').eq($('#test option').length - 1).val());
//獲取select的長度
$('#test option').length;
//添加一個option
$("#test").append("<option value='9'>ff</option>");
$("<option value='9'>ff</option>").appendTo("#test");
//添除選中項
$('#test option:selected').remove();
//指定項選中
$('#test option:first').remove();
//指定值被刪除
$('#test option').each(function(){
if( $(this).val() == '5'){
$(this).remove();
}
});
$('#test option[value=5]').remove();
//獲取第一個Group的標簽
$('#test optgroup:eq(0)').attr('label');
//獲取第二group下面第一個option的值
$('#test optgroup:eq(1) :option:eq(0)').val();

相關文章

最新評論