$("textarea[maxlength]").bind('paste', function(e) {// 鼠标右键粘帖
var area = $(this);
setTimeout(function() {
var max=parseInt(area.attr("maxlength"),10); //获取maxlength的值
if(max>0){
if(area.val().length>max){ //textarea的文本长度大于maxlength
area.val(area.val().substr(0,max)); //截断textarea的文本重新赋值
}
}
area.parents(".form-dd").find(".input-value-length").html(area.val().length + '/' + max);
}, 100);
var area = $(this);
setTimeout(function() {
var max=parseInt(area.attr("maxlength"),10); //获取maxlength的值
if(max>0){
if(area.val().length>max){ //textarea的文本长度大于maxlength
area.val(area.val().substr(0,max)); //截断textarea的文本重新赋值
}
}
area.parents(".form-dd").find(".input-value-length").html(area.val().length + '/' + max);
}, 100);
});
$(function(){
$('a').mousedown(function(e){
alert(e.which) // 1 = 鼠标左键 left; 2 = 鼠标中键; 3 = 鼠标右键
return false;//阻止链接跳转
})
})
如
$('#downwps2010').mousedown(function(e){
if(3 == e.which){
alert('这 是右键单击事件');
}else if(1 == e.which){
alert('这 是左键单击事件');
}
})