📄 product_add.asp
字号:
<!--#include file="i_login.asp"-->
<%
select case mode
case "save"
save_sub
end select
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>添加产品</title>
<LINK href="images/style.css" type=text/css rel=stylesheet>
<script language="javascript" src="../inc/functions.js"></script>
<script language="javascript" src="images/color.js"></script>
<script type="text/javascript">
function chk(form)
{
if(form.classid.value=="" || form.item.value=="" ){
if(form.classid.value==""){
alert("请选择目录");
form.classid.focus();
}else{
alert(" 请填写名称!");
form.item.focus();
}
return false;
}
else
{
return true;
}
}
</script>
</head>
<body >
<iframe width="260" height="165" id="colourPalette" src="images/nc_selcolor.htm" style="visibility:hidden; position: absolute; left: 0px; top: 0px;border:1px gray solid" frameborder="0" scrolling="no" ></iframe>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="26" class="gray"> CMS >> 添加作品</td>
</tr>
</table>
<table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#C2BDBD">
<form action="?mode=save" method="post" name="form1" enctype="multipart/form-data" onSubmit="return chk(this);" >
<tr>
<td height="25" align="center" bgcolor="#CCCCCC">目录<font color="#FF0000"> </font></td>
<td align="left" bgcolor="#FFFFFF"><select name="classid" >
<%
call site_class_showpid(0," ")
function site_class_showpid(byval classid,byval str)
dim rs,request_id
if str=" " then
response.Write("<option value="""">请选择</option>")
end if
set rs=conn.execute("select id,name from data_class where classid="&classid&" order by orderby,id")
while not rs.eof
response.Write("<option value="""&rs("id")&""">"&str&rs("name")&"</option>")
site_class_showpid cint(rs("id")),str & " "
rs.movenext
wend
rs.close
set rs=nothing
end function
%>
</select><script language="javascript">document.form1.classid.value='<%=session("temp_product_classid")%>';</script></td>
</tr>
<tr>
<td width="12%" height="25" align="center" nowrap bgcolor="#CCCCCC">名称</td>
<td width="88%" align="left" nowrap bgcolor="#FFFFFF"><input name="item" type="text" class="input" id="item" size="60">
<input type="hidden" name="color" id="color" value="">
<img src="images/rect.gif" width="18" height="17" border=0 style="cursor:pointer;background-Color:;" title="选取颜色!" onClick="Getcolor(this,'color');"> </td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="22" align="center" nowrap bgcolor="#CCCCCC">编号</td>
<td align="left" nowrap><input name="code" type="text" class="input" id="code" size="60"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="22" align="center" nowrap bgcolor="#CCCCCC">颜色</td>
<td align="left" nowrap><input name="colour" type="text" class="input" id="colour" size="60"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="22" align="center" nowrap bgcolor="#CCCCCC">规格</td>
<td align="left" nowrap><input name="size" type="text" class="input" id="size" size="60"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="22" align="center" nowrap bgcolor="#CCCCCC">材料</td>
<td align="left" nowrap><input name="material" type="text" class="input" id="material" size="60"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="22" align="center" nowrap bgcolor="#CCCCCC">价格</td>
<td align="left" nowrap><input name="price" type="text" class="input" id="price" onBlur="if(/[^0-9.]+/.test(this.value)){alert('Incorrect format');this.value='';}" size="60"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="22" align="center" bgcolor="#CCCCCC"> 推荐</td>
<td align="left"><label>
<input type="radio" name="homepage" id="radio" value="1">
是
<input name="homepage" type="radio" id="radio2" value="0" checked>
否</label></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="22" align="center" bgcolor="#CCCCCC">显示</td>
<td align="left"><input name="display" type="radio" id="radio3" value="1" checked>
是
<input name="display" type="radio" id="radio4" value="0">
否</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="22" align="center" bgcolor="#CCCCCC">图片</td>
<td align="left"><table border="0" cellspacing="5" cellpadding="0">
<tr>
<td width="64" height="64" align="center" valign="middle" id="previewImage1"><img src="images/upimgbg.gif" width="64" height="64" style="border:#EFEFEF solid 1px;" align=absmiddle/></td>
<td><span style=" float:left;">
<input name="file1" type="file" id="file1"
style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; MARGIN-BOTTOM: 2px; PADDING-BOTTOM: 3px; PADDING-TOP: 4px"
onchange="document.getElementById('previewImage1').innerHTML = '\<img src=\''+this.value+'\' width=64 height=64 onload=\'ResizeImage(this, 64, 64);\' align=absmiddle\>';" />
</span></td>
<td valign="bottom" nowrap><span onClick="javascript:showList(show);" style="cursor:pointer;color:#0000ff;">详细信息↓</span></td>
</tr>
</table></td>
</tr>
<tr bgcolor="#FFFFFF" id="show" style="display:none">
<td height="22" align="center" bgcolor="#CCCCCC">SEO</td>
<td align="left"><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" bgcolor="#E8F8FF">关键字</td>
<td align="left"><label>
<textarea name="keywords" cols="45" rows="5" class="input" id="keywords"></textarea>
</label></td>
</tr>
<tr>
<td align="center" bgcolor="#E8F8FF">描述</td>
<td align="left"><textarea name="Description" cols="45" rows="5" class="input" id="Description"></textarea></td>
</tr>
</table></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="22" align="center" bgcolor="#CCCCCC">内容</td>
<td align="left"><input name="content" type="hidden">
<iframe ID="js2" src="../ewebeditor/ewebeditor.htm?id=content&style=gray" frameborder="0" scrolling="no" width="100%" HEIGHT="350"></iframe></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="22" colspan="2" align="center" bgcolor="#CCCCCC"><label>
<input type="submit" name="Submit" value=" 提 交 " >
</label></td>
</tr>
</form>
</table>
</body>
</html>
<%
conn.close
set conn=nothing
%>
<%
sub save_sub
%>
<!--#include FILE="../inc/upload.inc"-->
<%
dim classid,item,color,code,colour,size,material,price,content
dim request_keywords,request_Description
dim file,upload,fileExt,ranNum,picname,formName,filename,picname_s,filename_s
dim myfile(),i
set upload=new upload_bird ''建立上传对象
classid=trim(upload.form("classid"))
item=trim(upload.form("item"))
color=trim(upload.form("color"))
code=trim(upload.form("code"))
colour=trim(upload.form("colour"))
size=trim(upload.form("size"))
material=trim(upload.form("material"))
price=trim(upload.form("price"))
content=trim(upload.form("content"))
homepage=trim(upload.form("homepage"))
display=trim(upload.form("display"))
request_keywords=trim(upload.form("keywords"))
request_Description=trim(upload.form("Description"))
if classid="" or item="" then
call msg("未填写完整!","-1")
end if
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open "data_product", Conn, 1,2
rs.addnew
rs("classnames")=get_classnames(classid)
rs("classid")=classid
rs("item")=item
rs("color")=color
rs("code")=code
rs("colour")=colour
rs("size")=size
rs("material")=material
if price<>"" then
rs("price")=price
end if
rs("content")=content
rs("keywords")=request_keywords
rs("Description")=request_Description
rs("tuijian")=homepage
rs("display")=display
rs.update
'------------------上传图片
i=0
for each formName in upload.file ''列出所有上传了的文件
Set file=upload.file(formName) ''生成一个文件对象
If file.filesize>1 Then
'说明有文件数据
If file.filesize>c_size*1024 Then
set file=nothing
set upload=nothing
call msg("Please choose picture (must be within "&c_size&"KB size)。","product_edit.asp?id="&rs("id")&"")
End If
fileExt=lcase(right(file.filename,4))
if fileEXT <>"" and fileEXT<>".gif" and fileEXT<>".jpg" then
call msg("Wrong file format (only for .Gif, or .Jpg file), please check.","product_edit.asp?id="&rs("id")&"")
end if
ReDim Preserve myfile(i)
set myfile(i)=file
i=i+1
End If
set file=nothing
Next
i=0
for each file in myfile
i=i+1
picname=year(now)&month(now)&"/"&rs("id")&lcase(right(file.filename,4))
picname_s=year(now)&month(now)&"/"&rs("id")&"_s"&lcase(right(file.filename,4))
response.Write("")
filename=c_pic&picname
filename_s=c_pic&picname_s
call myfind(filename)
file.SaveAs Server.mappath(filename)'保存文件
rs("img")=get_img_s(filename,filename,c_product_width,c_product_height)
rs("img_s")=get_img_s2(filename,filename_s,c_product_width_s,c_product_height_s)
set file=nothing
Next
rs.update
'--------------------------
rs.close
set rs=nothing
'保存状态
session("temp_product_classid")=classid
response.Write("<script>alert('添加成功.');</script>")
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -