欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jquery 使用點(diǎn)滴函數(shù)代碼

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

<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("賬號(hào)不能為空");
$("#txtUsername").focus();
return false;
}
if (pwd == "") {
$("#lblInfo").html("密碼不能為空");
$("#txtPassword").focus();
return false;
}
});
});
</script>


2、下拉列表的處理
復(fù)制代碼 代碼如下:

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


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

相關(guān)文章

最新評(píng)論