📄 basket_add.js
字号:
function checkdata(theForm) {
if (theForm.p_num.value==""){
alert("请您填写你所需的产品数量!");
theForm.p_num.focus();
return (false);
}
if (!isItemNum(theForm.p_num.value)){
alert("产品数量只能填写数字!");
theForm.p_num.focus();
return (false);
}
if (theForm.p_num.value < 1)
{
alert("数量不能为负或零!");
theForm.p_num.focus();
return (false);
}
window.open("/business/basket_insert.asp?sn_num="+theForm.sn_num.value+"&p_num="+theForm.p_num.value+"&city_id="+theForm.city_id.value,"basket","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=110,top=100,width=580,height=400");
// window.close()
// theForm.action="basket_insert.asp";
// theForm.target="basket";
// theForm.submit();
return false;
}
function isCharsInBag (s, bag)
{
var i;
// Search through string's characters one by one.
// If character is in bag, append to returnString.
for (i = 0; i < s.length; i++)
{
// Check that current character isn't whitespace.
var c = s.charAt(i);
if (bag.indexOf(c) == -1)
return false;
}
return true;
}
//检测是否是数字
function isItemNum(s)
{
if (isEmpty(s))
{
alert("请输入产品数量!");
return false;
}
var validChar = "0123456789";
if (!isCharsInBag(s, validChar))
{
alert("您输入的数量" + s +"是无效的,\n\n请输入合法的整数!");
return false;
}
return true;
}
function isEmpty(s)
{
return ((s == null) || (s.length == 0))
}
function check_all() {
var i,sn_nums="",p_nums="";
for(i=1;i<14;i++){
theForm=document.forms("form"&i);
if ((document.theForm.sn_num.value !=="")&&(document.theForm.sn_num.checked !=="")&&(!isNaN(document.theForm.p_num.value)))
{
sn_nums=sn_nums+document.theForm.sn_num.value+",";
p_nums=p_nums+document.theForm.p_num.value+",";
}
}
if (isempty(p_nums)||isempty(sn_nums))
{
alert("你没有选择产品!");
return (false);
}
document.form_all.sn_num.value=sn_nums;
document.form_all.p_num.value=p_nums;
return (true);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -