//只读框不能得到光标
$("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();
});
Jquery小例子
最新推荐文章于 2022-10-24 18:37:49 发布