📄 product.asp
字号:
<!--#include file="check.asp"-->
<!--#include file="conn.asp"-->
<!--#include file="../Function/function.asp"-->
<%
ProductID = Trim(Request("ID"))
ProductType = Request("TypeID")
strTitle = "新 增 产 品"
Dim Rate
Rate = 0
If IsSubmit And CheckAdmin then
Dim msg,IsGood
Set rs=server.createobject("adodb.recordset")
Dim sContent1
For i = 1 To Request.Form("content").Count
sContent1 = sContent1 & Request.Form("content")(i)
Next
If ProductID = "" Then
msg = "产品名称添加成功!"
Rs.open "Select * from ProductList where pID Is null",conn,1,3
Rs.addnew
Else
msg = "产品修改成功!"
Rs.open "Select * from ProductList where pID=" & clng(ProductID) ,conn,1,3
End if
If Request.Form("checkbox")="1" Then
IsGood=1
Else
IsGood=0
End If
Rs("IsGood") = IsGood
Rs("Web_URL").Value = Request.Form("WebUrl")
Rs("ProductName")=request("ProductNamme")
Rs("ProductType")=Request("ProductType")
Rs("ProductPic") = Request("ADSrc")
Rs("Rate").Value = Clng(Request.Form("Rate"))
Rs("ProductDesc").Value = sContent1
'结束
rs.update
rs.close
Set rs=nothing
Call connclose()
Call MessageBoxOK(msg) '完成提示
ElseIF Len(ProductID)>0 Then
Dim StrSQL
Dim objRec
StrSQL = "Select pID,ProductName,ProductType,ProductPic,ProductDesc,IsGood,Web_URL,Rate from ProductList Where pID=" & ProductID
Set objRec = Conn.Execute(StrSQL)
With ObjRec
If .Eof And .Bof Then
Response.Write "<Script>alert('操作失败');histroy.back();</script>"
Response.End
Else
ProductID = .Fields(0).Value
ProductName = .Fields(1).Value
ProductType = .Fields(2).Value
ProductPic = .Fields(3).Value
Rate = .Fields("Rate").Value
WebURL = .Fields("Web_URL").Value
If IsNull(.Fields(4).Value) Then
ProductDesc = ""
Else
ProductDesc = .Fields(4).Value
End If
ProductIsGood = .Fields(5).Value
End If
End With
Call connclose()
End if
Private Sub MessageBoxOK(strValue)
'response.write "<script>alert('新闻添加成功!');parent.location.href='index.asp'</script>"
With Response
.Write "<script>" & vbcrlf
.Write "alert('"+strValue+"');" & vbcrlf
.Write "location.href='Productmanage.asp?TypeID=" & Request("ProductType") & "'" & vbcrlf
.Write "</script>" & vbcrlf
End With
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" href="../css/style.css" type="text/css">
<script language = "JavaScript">
var errmsg;
function haveNoImage(p_Value,frm)
{
var imgurl;
imgurl = trim(p_Value);
if (imgurl.length==0)
{
alert("请上传推荐图片");
frm.ADSrc.focus();
return false;
}
var sExt=imgurl.substr(imgurl.lastIndexOf(".")+1).toUpperCase();
switch(sExt){
case "GIF":
return true;
break;
case "JPG":
return true;
break;
case "BMP":
return true;
break;
default:
alert("请不要修改上传后的文件格式!");
frm.ADSrc.value="";
return false;
break;
}
return true;
}
function trim(val)
{
var str = val+"";
if ( str.length == 0 )
return str;
var re = /^\s*/;
str = str.replace(re,'');
re = /\s*$/;
return str.replace(re,'');
}
function CheckForm(frm)
{
if (frm.ProductNamme.value=="")
{
alert("温馨提示\n请填写产品名称!");
frm.ProductNamme.focus();
return false;
}
if(!haveNoImage(frm.ADSrc.value,frm))
{
frm.ADSrc.focus();
return false;
}
return true;
}
</script>
</head>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<form method="POST" name="form" onSubmit="return CheckForm(this);" target="_self">
<tr>
<td height="20" align="center" class="title"><b><%=strTitle%></b></td>
</tr>
<tr align="center">
<td class="tdbg">
<table width="100%" border="0" cellpadding="0" cellspacing="2">
<tr>
<td width="10%" align="right">产品名称:</td>
<td width="80%" colspan="3">
<input name="ProductNamme" type="text" size="40" maxlength="100" value="<%=ProductName%>"></td>
</tr>
<tr>
<td align="right">所属类型:</td>
<td colspan="3">
<select name="TypeList">
<%
Call ListProductType("")
%>
</select> </td>
</tr>
<tr>
<td align="right">价络范围:</td>
<td>
<select name="Rate">
<%
Call ShowRate(0,Rate)
'Call ListProductType("")
%>
</select>
</td>
</tr>
<tr>
<td align="right">
图片上传:</td>
<td>
<iframe class="TBGen" style="top:2px" ID="UploadFiles" src="../upload.asp" frameborder=0 scrolling=no width="100%" height="25"></iframe>
</td>
</tr>
<tr>
<td align="right">图片地址:</td>
<td colspan="3">
<input name="ADSrc" type="text" size="40" value="<%=ProductPic%>">
</td>
</tr>
<tr>
<td align="right">是否推荐:</td>
<td colspan="3"><input type="checkbox" name="checkbox" value="1" <%If ProductIsGood = 1 Then Response.Write "checked" End if %>>
(打上勾,此产品为特别推荐产品)</td>
</tr>
<tr>
<td align="right">网址:</td>
<td colspan="3"><input name="WebUrl" type="text" id="WebUrl" value="<%=WebUrl%>" size="40"></td>
</tr>
<tr>
<td align="right" valign="top">产品描述:</td>
<td colspan="3">
<input type="hidden" name="ProductType" Value ="<%=ProductType%>">
<INPUT type="hidden" name="content" value="<%=Server.HTMLEncode(ProductDesc)%>">
<IFRAME ID="eWebEditor1" SRC="../editor/ewebeditor.asp?id=content&style=standard_coolblue" FRAMEBORDER="0" SCROLLING="no" WIDTH="550" HEIGHT="350"></IFRAME>
</td>
</tr>
<tr>
<td align="right"> </td>
<td colspan="3"><input name="submit1" type="submit" value=" 保 存 ">
<input name="reset1" type="reset" value=" 重 来 ">
<input name="btnback" type="button" value=" 返 回 " onclick="javascript:history.back();">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="hidden" value="<%=ProductID%>" name="ProductID">
</td>
</tr>
</form>
</table>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -