//分页 function Show_gl(z) { var gs=document.getElementById("Whatever"); if (gs==null) return; gs=gs.gs; var obj; if (z==0) { for(var i=0;i 2){ re = re.substring(0,re.length - 1) } return re; } //收藏 function sc(id,fl) { ajax.get("/Pos/ajax.aspx?1=ls^"+id+"^"+fl,sc_re); } function sc_re(z) { z=z.responseText; if (z=="-1")//你没有登陆,请先登陆再进行收藏 { if (confirm("你还没有登陆,是否登陆")) { window.location="/Login/index.aspx?http="+setAscII(window.location.href); } else {return false;} } alert("操作完毕") } //------------------把物品放入购物车同时弹出数量 function gwc_tj_sl(id) { var sl=prompt("请输入购买数量:", "1"); //数量 if (!isDecimal(sl)) { alert("您输入的购买数量错误,所输入的必须是数字"); return; } ajax.get("/Pos/ajax.aspx?1=gwc^"+id+"^"+sl,gwc_tj_re); } //------------------购物车 function gwc_tjn(id,sl) { ajax.get("/Pos/ajax.aspx?1=gwc^"+id+"^"+sl,gwc_tj_re); } function gwc_tj() { var ob=document.getElementById("gmc_sl"); if (ob==null) { alert("对像为空请重试"); return; } var sl=ob.options[ob.selectedIndex].value; //数量 var id=document.getElementById("sp_id"); //商品 if (id==null) { alert("取不到所选商品"); return; } id=id.value; //id ajax.get("/Pos/ajax.aspx?1=gwc^"+id+"^"+sl,gwc_tj_re); } //---------------------------------购物车返回处理 function gwc_tj_re(z) { z=z.responseText; if (z=="-1")//你没有登陆,请先登陆再进行购物 { window.location="/Login/index.aspx?http="+setAscII(window.location.href); return; } if (z=="-2") {alert("加入购物车失败,请重试");return false;} alert("已经将物品放入了购物车,请继续购物"); } function ob_re(z) { if (document.getElementById(z)==null) return document.getElementsByName(z); else return document.getElementById(z); } function img_auto_size(ImgD,iwidth,iheight)//参数(图片,允许的宽度,允许的高度) { var image=new Image(); image.src=ImgD.src; if(image.width>0 && image.height>0){ if(image.width/image.height>= iwidth/iheight){ if(image.width>iwidth){ ImgD.width=iwidth; ImgD.height=(image.height*iwidth)/image.width; }else{ ImgD.width=image.width; ImgD.height=image.height; } } else{ if(image.height>iheight){ ImgD.height=iheight; ImgD.width=(image.width*iheight)/image.height; }else{ ImgD.width=image.width; ImgD.height=image.height; } } } } //函数名:isDecimal //功能介绍:检查是否为数字 //参数说明:要检查的数字 //返回值:true,false function isDecimal(NUM) { var i,j,strTemp; strTemp="0123456789."; if ( NUM.length== 0) return 0 for (i=0;i