我在JQuery中有这段代码:
$(function (){
$("#TxtName").bind('input',function(){
if(/[~!@#$%^&*)(_+÷×A-Za-z0-9+-\.]/.test(this.value)){
$(".char_test_TxtName").css("visibility","visible");
$(this).val('');
}else{
$(".char_test_TxtName").css("visibility","hidden");
}
});
});
有人可以告诉我为什么绑定在IE8中不起作用吗?
答案 0 :(得分:1)
答案 1 :(得分:0)
mozilla文档建议使用在脚本开头添加以下代码,以部分支持不完全支持它的浏览器中的bind()方法:
if (!Function.prototype.bind) {
Function.prototype.bind = function(oThis) {
if (typeof this !== 'function') {
// closest thing possible to the ECMAScript 5
// internal IsCallable function
throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
}
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
fNOP = function() {},
fBound = function() {
return fToBind.apply(this instanceof fNOP
? this
: oThis,
aArgs.concat(Array.prototype.slice.call(arguments)));
};
fNOP.prototype = this.prototype;
fBound.prototype = new fNOP();
return fBound;
};
}http://www.sparxeng.com/blog/software/must-use-net-system-io-ports-serialport