📄 product_info_modi.asp
字号:
<!--#include file="admin_check.asp"-->
<%dim dbpath
dbpath="../"
%>
<!--#include file="../Conn.asp"-->
<!--#include file="../include/MyRequest.asp"-->
<%
id=my_request("id",1)
if id="" or isnull(id) or IsNumeric(id)=False then
response.write("<script>alert(""参数错误!"");location.href=""product_info_List.asp"";</script>")
response.end
end if
Set rs= Server.CreateObject("ADODB.Recordset")
sql="select id,cid,product_info_name,product_info_flag,product_info_PriceM,product_info_PriceS,product_info_PicB,product_info_PicS,product_info_OnOff,product_info_AdWord from product_info where id="&id
rs.open sql,conn,1,1
id =rs(0)
cid =rs(1)
product_info_name =rs(2)
product_info_flag =rs(3)
product_info_PriceM =rs(4)
product_info_PriceS =rs(5)
product_info_PicB =rs(6)
product_info_PicS =rs(7)
product_info_OnOff =rs(8)
product_info_AdWord =rs(9)
rs.close
set rs=nothing
action=my_request("action",0)
if action="save" then
call save()
end if
sub save()
id = my_request("id",1)
cid = my_request("cid",1)
product_info_name = my_request("product_info_name",0)
product_info_AdWord = my_request("product_info_AdWord",0)
product_info_flag = my_request("product_info_flag",0)
product_info_PriceM = my_request("product_info_PriceM",0)
product_info_PriceS = my_request("product_info_PriceS",0)
product_info_PicS = my_request("product_info_PicS",0)
product_info_PicB = my_request("product_info_PicB",0)
product_info_Detail = my_request("content",0)
product_info_OnOff = my_request("product_info_OnOff",1)
ErrMsg=""
if id="" then
FoundErr=True
ErrMsg=ErrMsg & "<li>商品ID不能为空!</li>"
end if
if product_info_name="" then
FoundErr=True
ErrMsg=ErrMsg & "<li>商品名称不能为空!</li>"
end if
if cid="" then
FoundErr=True
ErrMsg=ErrMsg & "<li>商品类别必须选择!</li>"
end if
if product_info_PriceS="" then
FoundErr=True
ErrMsg=ErrMsg & "<li>本站价格不能为空!</li>"
end if
if product_info_PicS="" then
FoundErr=True
ErrMsg=ErrMsg & "<li>商品小图片不能为空!</li>"
end if
if product_info_PicB="" then
FoundErr=True
ErrMsg=ErrMsg & "<li>商品大图片不能为空!</li>"
end if
if product_info_Detail="" then
FoundErr=True
ErrMsg=ErrMsg & "<li>商品详细描述不能为空!</li>"
end if
if FoundErr<>True then
set rs=server.createobject("adodb.recordset")
sql="select * from product_info Where product_info_name='"&product_info_name&"' and id<>"&id
rs.open sql,conn,1,1
if not rs.eof and rs.bof then
response.write "<script language='javascript'>"
response.write "alert('出错了,商品标题重复,请重新录入!');"
response.write "location.href='javascript:history.go(-1)';"
response.write "</script>"
response.end
end if
rs.close
set rs=nothing
set rs=Server.CreateObject("ADODB.Recordset")
sql="select * from product_info where id="&id
rs.open sql,conn,1,3
rs("cid")=cid
rs("product_info_name") = product_info_name
rs("product_info_AdWord") = product_info_AdWord
rs("product_info_flag") = product_info_flag
rs("product_info_PriceM") = product_info_PriceM
rs("product_info_PriceS") = product_info_PriceS
rs("product_info_PicB") = product_info_PicB
rs("product_info_PicS") = product_info_PicS
rs("product_info_Detail") = product_info_Detail
rs("product_info_OnOff") = product_info_OnOff
rs("addtime") = now()
rs.update
rs.close
set rs=nothing
call ok("您已成功编辑更新了一条商品信息!","product_info_list.asp")
else
call WriteErrMsg(ErrMsg)
end if
end sub
%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>商品信息编辑</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="Editor/edit.js" type="text/javascript"></script>
<script language = "JavaScript">
var imgObj;
function checkImg(theURL,winName){
// 对象是否已创建
if (typeof(imgObj) == "object"){
// 是否已取得了图像的高度和宽度
if ((imgObj.width != 0) && (imgObj.height != 0))
// 根据取得的图像高度和宽度设置弹出窗口的高度与宽度,并打开该窗口
// 其中的增量 20 和 30 是设置的窗口边框与图片间的间隔量
OpenFullSizeWindow(theURL,winName, ",width=" + (imgObj.width+20) + ",height=" + (imgObj.height+30));
else
// 因为通过 Image 对象动态装载图片,不可能立即得到图片的宽度和高度,所以每隔100毫秒重复调用检查
setTimeout("checkImg('" + theURL + "','" + winName + "')", 100)
}
}
function OpenFullSizeWindow(theURL,winName,features) {
var aNewWin, sBaseCmd;
// 弹出窗口外观参数
sBaseCmd = "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,";
// 调用是否来自 checkImg
if (features == null || features == ""){
// 创建图像对象
imgObj = new Image();
// 设置图像源
imgObj.src = theURL;
// 开始获取图像大小
checkImg(theURL, winName)
}
else{
// 打开窗口
aNewWin = window.open(theURL,winName, sBaseCmd + features);
// 聚焦窗口
aNewWin.focus();
}
}
function loaded(myimg,mywidth,myheight)
{
var tmp_img = new Image();
tmp_img.src = myimg.src;
image_x = tmp_img.width;
image_y=tmp_img.height;
if(image_x > mywidth)
{
tmp_img.height = image_y * mywidth / image_x;
tmp_img.width = mywidth;
if(tmp_img.height > myheight)
{
tmp_img.width = tmp_img.width * myheight / tmp_img.height;
tmp_img.height=myheight;
}
}
else if(image_y > myheight)
{
tmp_img.width = image_x * myheight / image_y;
tmp_img.height=myheight;
if(tmp_img.width > mywidth)
{
tmp_img.height = tmp_img.height * mywidth / tmp_img.width;
tmp_img.width=mywidth;
}
}
myimg.width = tmp_img.width;
myimg.height = tmp_img.height;
}
</script>
</head>
<body>
<table cellspacing="1" cellpadding="4" width="100%" class="tableborder">
<tbody class="altbg2">
<form action="Product_Info_Modi.asp" method="post" name="form1">
<input type="hidden" name="action" value="save">
<input type="hidden" name="id" value="<%=id%>">
<tr>
<td colspan="3" class="title">商品信息编辑</td>
</tr>
<tr>
<td>商品名称及规格:</td>
<td colspan="2">
<input type="text" name="product_info_name" size="30" value="<%=product_info_name%>"></td>
</tr>
<tr>
<td>加促销语:</td>
<td colspan="2"><select size="1" name="product_info_AdWord">
<option value="" <%if product_info_flag="" then response.write "selected"%>>不加任何促销语(默认)</option>
<option value="赞" <%if product_info_flag="赞" then response.write "selected"%>>赞</option>
<option value="热门" <%if product_info_flag="热门" then response.write "selected"%>>热门</option>
<option value="店长赞" <%if product_info_flag="店长赞" then response.write "selected"%>>店长赞</option>
<option value="抢购中" <%if product_info_flag="抢购中" then response.write "selected"%>>抢购中</option>
<option value="价格新底" <%if product_info_flag="价格新底" then response.write "selected"%>>价格新底</option>
<option value="店长严重推荐" <%if product_info_flag="店长严重推荐" then response.write "selected"%>>店长严重推荐</option>
<option value="新品上市,棒!" <%if product_info_flag="新品上市,棒!" then response.write "selected"%>>新品上市,棒!</option>
<option value="超特价,当到谷底" <%if product_info_flag="超特价,当到谷底" then response.write "selected"%>>超特价,当到谷底</option>
<option value="人气绝项,销售佳!" <%if product_info_flag="人气绝项,销售佳!" then response.write "selected"%>>人气绝项,销售佳!</option>
</select></td>
</tr>
<tr>
<td>所属商品类别:</td>
<td colspan="2"><select name="cid">
<%
sql="select cid,product_class_name from product_class order by cid desc"
set rs=conn.execute (sql)
set cid1=rs(0)
set product_class_name=rs(1)
do while not rs.eof
%>
<option value="<%=cid1%>" <%if cid1=cint(cid) then response.write "selected" %>><%=product_class_name%></option>
<%
rs.movenext
loop
rs.close
set rs=nothing
%>
</select></td>
</tr>
<tr>
<td>市场价:</td>
<td colspan="2">
<input type="text" name="product_info_PriceM" size="20" value="<%=product_info_PriceM%>"></td>
</tr>
<tr>
<td>本站价:</td>
<td colspan="2">
<input type="text" name="product_info_PriceS" size="20" value="<%=product_info_PriceS%>"></td>
</tr>
<tr>
<td>小图片:</td>
<td>
<input type="text" name="product_info_PicS" size="30" value="<%=product_info_PicS%>">
<input type="button" value=">>点此上传商品小图片" name="action0" onclick="javascript:openWin('Njj_Pic_Upload.asp?Fname=product_info_PicS','upload','toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=yes,width=400,height=100')">
</td>
<td rowspan="2">
<p align="center"><a target="_blank" title="点击查看商品大图片" href="../uploadpic/<%=product_info_PicB%>" onClick="OpenFullSizeWindow(this.href,'','');return false"><img src=../uploadpic/<%=product_info_PicS%> border=0 onload='loaded(this,80,80)' ><br>点击原小图可查看原大图</a></td>
</tr>
<tr>
<td>大图片:</td>
<td>
<input type="text" name="product_info_PicB" size="30" value="<%=product_info_PicB%>">
<input type="button" value=">>点此上传商品大图片" name="action1" onclick="javascript:openWin('Njj_Pic_Upload.asp?Fname=product_info_PicB','upload','toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=yes,width=400,height=100')">
</td>
</tr>
<tr>
<td>详细描述:</td>
<td colspan="2">
<!--//商品介绍//-->
<!--#include file="editor/editor.asp"-->
<script language="javascript">
document.write ('<iframe src="product_txtbox.asp?id=<%=id%>&action=modify" id="message" width="90%" height="300"></iframe>')
frames.message.document.designMode = "On";
</script>
</td>
</tr>
<tr>
<td>商品特性:</td>
<td colspan="2"><input type="checkbox" name="product_info_flag" value="1" <%if instr(product_info_flag,1) then response.write "checked" %>>新品
<input type="checkbox" name="product_info_flag" value="2" <%if instr(product_info_flag,2) then response.write "checked" %>>推荐
<input type="checkbox" name="product_info_flag" value="3" <%if instr(product_info_flag,3) then response.write "checked" %>>特价</td>
</tr>
<tr>
<td>是否上架:</td>
<td colspan="2"><input type="radio" value="0" name="product_info_OnOff" <%if product_info_OnOff=0 then response.write "checked" %>>上架(显示)
<input type="radio" value="1" name="product_info_OnOff" <%if product_info_OnOff=1 then response.write "checked" %>>下架(隐藏) </td>
</tr>
<tr>
<td> </td>
<td colspan="2"><input type="submit" value="提交" name="Submit1" onclick="document.form1.Content.value = frames.message.document.body.innerHTML;">
<input type="reset" value="重置" name="B2">
<input type="hidden" name="Content" value>
</td>
</tr>
</form>
</tbody>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -