Jquery小例子


//只读框不能得到光标
$("input[readonly]").each(function(){
$(this).bind("focus",function(){$(this)[0].blur();});
});

//全选checkbox
$("#all_box").click(function(){
var all_box=$(this);
$("input[name='checkbox_']").each(function(i){
if($(this).is(":disabled")==false){
$(this).get(0).checked=all_box.get(0).checked;
}
});
});

//超出长度 用“...”代替
$("td").each(function(i){
if($(this).attr("lang")!=undefined && $(this).attr("lang") == "tdTitle"){
if($(this).attr("id")==undefined || isNaN($(this).attr("id"))){
if($(this).text().length>25){
$(this).attr("title",$(this).text());
$(this).text($(this).text().substring(0,20)+"...");
}
}else{

var length=$(this).attr("id");

if($(this).text().length>length){
$(this).attr("title",$(this).text());
$(this).text($(this).text().substring(0,length-4)+"...");
}
}
}
});

//禁止右键
$(document).bind("contextmenu",function(e){
return false;
});

//禁止修改浏览的文件路径
$("input[type='file']").bind('paste cut',function(e){
e.preventDefault();
}).bind("keyup keydown",function(e){
return false;
e.preventDefault();
});
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值