首页 > 代码库 > JS 同步输入

JS 同步输入

var txtBigBalance;
//金额同步输入
if ($.browser.msie)//IE
{
$("#txtBalanceP").get(0).onpropertychange = getBalance;
$("#txtbigBalance").get(0).onpropertychange = eventHandler;
}
else {
var intervalName;
$("#txtBalanceP").get(0).addEventListener("input", getBalance, false);
$("#txtBalanceP").focus(function () {
intervalName = setInterval(eventHandler, 1000);
});
$("#txtBalanceP").blur(function () {
clearInterval(intervalName);
});
}
function getBalance() {
$("#txtbigBalance").val($(this).val());
}
function eventHandler() {
if ($("#txtbigBalance").val() != txtBigBalance) {
txtBigBalance = $("#txtbigBalance").val();
}
}