📄 common.js
字号:
var saleArrOne;
$(document).ready(function(){
$("#serialNo").blur(function(){
LoadProductInfo($(this).val());
});
$("#amount").keyup(function(){
if($(this).val()<1){
$("#amountError").html("数量不能小于1").css("color","red");
}else if($(this).val().length > 4){
$("#amountError").html("提示!购买数量超过4位数,请确保交易有效性").css("blue","red");
}else{
$("#amountError").html("");
}
});
$("#categoryId").change(function(){
var categoryId = $(this).val();
var arr;
$("#scale").val('');
for(var index=0;index<saleArrOne.length;index++){
arr=saleArrOne[index].split(':');
if(arr[0]==categoryId){
$("#scale").val(arr[1]);
}
}
});
});
//加载产品资料
function LoadProductInfo(productNo){
//判断此页面属于那种mode
//加载接口
if($('#action').val()=='edit')return;
var ajaxUrl = "../AjaxProductInfoServlet";
$.ajax({
type: "GET",
url: ajaxUrl,
data: "productNo=" + productNo,
dataType: "json",
success: function(json){
if(json==null)
{
ShowProductInfo(productNo);
}else{
ShowProductError();
}
},
error: function(){ ShowProductError() },
beforeSend: function(){$("#productError").html('loading...');}
});
}
function ShowProductInfo(productNo){
$("#productError").html("商品编号可用").css("blue","red");
$("#submit").removeAttr("disabled");
}
function ShowProductError(){
$("#submit").attr("disabled","disabled");$("#productError").html("商品编号已被占用").css("color","red");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -