⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 product_edit.asp

📁 ASP网页
💻 ASP
字号:

<%@ Language=VBScript%>
<%
Response.Buffer=true
Response.Expires=0

if Session("userqx")>="1" or Session("userqx")<="9" then
else
	Response.Redirect "../warn.asp"
end if
%>
<!-- #include file="../dsn.asp" -->
<%
productno=Request.QueryString("productno")
if productno="" then productno="0"

set cn = Server.CreateObject("ADODB.Connection")
cn.Open(mycnstr)
set rs = Server.CreateObject("ADODB.Recordset")
set rs2 = Server.CreateObject("ADODB.Recordset")

classcode=Request.QueryString("classcode")
flag=Request.QueryString("flag")
pageno=Request.QueryString("pageno")

htmlname="product_edit.asp?productno="+productno+"&classcode="+classcode+"&flag="+flag+"&pageno="+pageno
backhtml="product_admin.asp?classcode="+classcode+"&flag="+flag+"&pageno="+pageno
tablename="product"
%>
<html>
<head>
<title>基本资料</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {font-size: 12px; color: #000000; font-family: 宋体}
td {font-size: 12px; color: #000000; font-family: 宋体;}
.t1 {font:12px 宋体;color=000000} 
.t2 {font:12px 宋体;color:ffffff} 

.bt1 {font:14px 宋体;color=000000} 
.bt2 {font:14px 宋体;color:ffffff} 

A:link {color: #000066}
A:visited {color: #000066}
A:hover {color: #ff0000}

A.r1:link {font-size:12px;text-decoration:underline;color:#000000;}
A.r1:visited {font-size:12px;text-decoration:underline;color:#000000;}
A.r1:hover {font-size:12px;text-decoration:underline;color:#ff6600;}

A.r2:link {font-size:12px;text-decoration:underline;color:#ffffff;}
A.r2:visited {font-size:12px;text-decoration:underline;color:#ffffff;}
A.r2:hover {font-size:12px;text-decoration:underline;color:#ff6600;}
-->
</style>
</head>

<body bgcolor=#ffffff topmargin=10>
<form action="<%=htmlname%>" method=post name=editform onsubmit="return checkform(editform)" autocomplete = "off">
<%
bz=1

if Request.ServerVariables("REQUEST_METHOD")="POST" then
	productno=Request.QueryString("productno")
	bz=0
	sortnum=Request.Form("sortnum")
	title=trim(Request.Form("title"))
	content=Request.Form("content")
	
	if bz=0 then
		 if productno="0" then
			sqltext="select top 1 productno from "+tablename+" order by productno desc"
			rs.Open sqltext,cn,1,1
			if rs.EOF then
				productno=1
			else
				productno=rs(0)+1
			end if
			rs.Close
			if sortnum="" or not isnumeric(sortnum) then
				sqltext="select top 1 sortnum from "+tablename+" where classcode='"+classcode+"' order by sortnum desc"
				rs.Open sqltext,cn,1,1
				if rs.EOF then
					sortnum=1	
				else
					sortnum=rs(0)+1
				end if
				rs.Close
			end if
			rs.Open tablename,cn,3,3
			rs.AddNew
			rs("productno")=productno
			rs("creadate")=Now()
			rs("classcode")=classcode
			rs("username")=Session("username")
		else	
			rs.Open "select * from "+tablename+" where productno="&productno,cn,3,3
		end if	
		if isnumeric(sortnum) then rs("sortnum")=sortnum
		rs("content")=content
		rs("title")=title
		rs("basclass")=trim(Request.Form("basclass"))
		rs("spec")=trim(Request.Form("spec"))
		rs("describe")=trim(Request.Form("describe"))

		rs("title2")=trim(Request.Form("title2"))
		rs("content2")=trim(Request.Form("content2"))
		rs("describe2")=trim(Request.Form("describe2"))
		
		rs("updatetime")=now()
		rs.Update

		Response.Write("<script language=Javascript>")
		Response.Write("window.location.href='"+backhtml+"'")
		Response.Write("</script>")
		
	end if
else
	if productno="0" then
		creadate=now()
		username=Session("username")
	else
		sqltext="select * from "+tablename+" where productno="&productno
		rs.Open sqltext,cn,1,1
		sortnum=rs("sortnum")
		title=trim(rs("title"))
		creadate=rs("creadate")
		updatetime=rs("updatetime")
		username=trim(rs("username"))
		basclass=trim(rs("basclass"))

		spec=trim(rs("spec"))
		describe=trim(rs("describe"))
		content=rs("content")

		title2=trim(rs("title2"))
		describe2=trim(rs("describe2"))
		content2=trim(rs("content2"))
	end if
end if	

if bz=1 or bz=2 or bz=3 then
	sqltext="select classcode,classname from "+tablename+"_class where classcode='"+classcode+"'"
	rs2.Open sqltext,cn,1,1
	if not rs2.EOF then
		classname=trim(rs2(1))
	end if
	rs2.Close
 %>
 
 <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr><td>
	<%if seekname="" then%>
		当前位置:<font color=ff4500><%=classname%></font> ←
	<%end if%>	
		<a href="<%=backhtml%>">返回列表</a></td></tr>
	<tr><td><hr size=1></td></tr>
	<tr bgcolor="#527c72"><td height=18><font class=t2>具体内容</font><br>
	</td></tr>
	<tr><td height=5></td></tr>
 </table>
 <table width="100%" border="0" cellspacing="1" cellpadding="0" align="center">
	<tr><td width=70 align=right>索引号:</td>
		<td>
		<%if Session("userqx")="9" then%>	
			<input type="text" value="<%=sortnum%>" name=sortnum maxlength=10 size=5 >
		<%else%>
			<input type="hidden" value="<%=sortnum%>" name=sortnum>
			<font color=800000><%=sortnum%></font>			
		<%end if%>	
		&nbsp;&nbsp;创建于:<font color=000000><%=creadate%></font>
		&nbsp;&nbsp;更新于:<font color=000000><%=updatetime%></font>
		</td></tr>
	<tr><td width=70 align=right>产品名称</td>
		<td><input type="text" value="<%=title%>" name=title maxlength=60 size=60><font color=ff4500> *</font></td></tr>
	<tr><td width=70 align=right>名称(英)</td>
		<td><input type="text" value="<%=title2%>" name=title2 maxlength=100 size=60><font color=ff4500> *</font></td></tr>
	<tr><td width=70 align=right>产品商标</td>
		<td class=td2><select name="basclass" style="width:90px">
		<%sqltext="select * from product_basclass order by sortnum"
		  rs2.Open sqltext,cn,1,1
		   do while not rs2.EOF
				Response.Write("<option value="+rs2("classcode"))
				if trim(rs2("classcode"))=basclass then Response.Write(" selected")
				Response.Write(">"+trim(rs2("classname")))
				rs2.MoveNext()
			loop				
			rs2.Close()
		%></select>
		</td></tr>
	<tr><td width=70 align=right>分子式</td>
		<td><input type="text" value="<%=spec%>" name=spec maxlength=120 size=66></td></tr>
	<tr><td width=70 align=right>产品描述</td>
		<td><textarea rows=3 cols=66 name=describe style="font-family:宋体" ><%=describe%></textarea></td>
	</tr>
	<tr><td width=70 align=right>描述(英)</td>
		<td><textarea rows=3 cols=66 name=describe2 style="font-family:宋体" ><%=describe2%></textarea></td>
	</tr>
	<tr><td width=70 align=right></td>
		<td>
			<img src="../admin/images/bold.gif" onclick="format('bold')" style="cursor:hand;" title="粗体">
			<img src="../admin/images/italicize.gif" onclick="format('italic')" style="cursor:hand;" title="斜体">
			<img src="../admin/images/underline.gif"  onclick="format('underline')" style="cursor:hand;" title="下划线">
			<img src="../admin/images/center.gif"  onclick="format('center')" style="cursor:hand;" title="居中">
			<img src="../admin/images/space.gif"  onclick="format('space')" style="cursor:hand;" title="空格">
		<select name=font style="width:120px" onchange="formatfont(this.options[this.selectedIndex].value)">
			<option value="宋体" selected>宋体
			<option value="楷体_gb2312">楷体GB2312
			<option value="黑体">黑体
			<option value="隶书">隶书
			<option value="Arial">Arial
			<option value="Arial Black">Arial Black
			<option value="Impact">Impact
			<option value="Tahoma">Tahoma
			<option value="Times New Roman">Times New Roman
			<option value="Verdana">Verdana
		</select>				
		<select name=fontsize style="width:50px" onchange="formatsize(this.options[this.selectedIndex].value)">
			<option value="6" >一号
			<option value="5">二号
			<option value="4">三号
			<option value="3">四号
			<option value="2"selected>五号
		</select>				
		<select name=color style="width:70px" onchange="formatcolor(this.options[this.selectedIndex].value)">
			<option style="background-color:black;color=black" value="black">黑色
			<option style="background-color:red;color=red" value="red">红色
			<option style="background-color:blue;color=blue" value="blue">蓝色
			<option style="background-color:green;color=green" value="green">绿色
			<option style="background-color:aqua;color=aqua"  value="aqua">浅绿色
			<option style="background-color:fuchsia;color=fuchsia" value="fuchsia">紫红色
			<option style="background-color:gray;color=gray" value="gray" selected>灰色			
			<option style="background-color:maroon;color=maroon" value="maroon">粟色
			<option style="background-color:navy;color=navy" value="navy">深蓝色
			<option style="background-color:olive;color=olive" value="olive">橄榄色
			<option style="background-color:purple;color=purple" value="purple">紫色
			<option style="background-color:teal;color=teal" value="teal">茶色			
			<option style="background-color:yellow;color=yellow" value="yellow">黄色
		</select>
		<input type=button value='内容预览' name=Button onclick=gopreview() style="">				
		</td></tr>
	<tr><td width=70 align=right>产品介绍</td>
		<td><textarea rows=8 cols=66 name=content style="font-family:宋体" ><%=content%></textarea></td>
	</tr>
	<tr><td width=70 align=right>介绍(英)</td>
		<td><textarea rows=8 cols=66 name=content2 style="font-family:宋体" ><%=content2%></textarea></td>
	</tr>
</table>	
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr><td width=200></td><td height=10></td></tr>
	<tr>
	<td width=200></td>
	<td align=left>
		<input type="submit" name="submit" value="确认提交">&nbsp;&nbsp;&nbsp;&nbsp;
	</td></tr>
</table>
<script language=Javascript>
		editform.title.focus()
</script>
<%
end if
%>
</form>
<form name=preview method=post action="../admin/content_view.asp" target=winview>
	<input type=hidden name=viewtitle value=""><input type=hidden name=viewbody value="">
</form>

<body>
</html>
<script language=Javascript>

	function format(flag)
	{
		switch(flag){
			case "bold":
				begintxt="<b>";
				endtxt="</b>";
				break;
			case "italic":
				begintxt="<i>";
				endtxt="</i>";
				break;
			case "underline":
				begintxt="<u>";
				endtxt="</u>";
				break;
			case "center":
				begintxt="<center>";
				endtxt="</center>";
				break;
			case "space":
				begintxt="&nbsp;";
				endtxt="";
				break;
		}
		dealcontent()
	}

	function formatcolor(newvalue)
	{
		begintxt="<font color="+newvalue+">"
		endtxt="</font>";
		dealcontent()
	}

	function formatfont(newvalue)
	{
		begintxt="<font face="+newvalue+">"
		endtxt="</font>";
		dealcontent()
	}

	function formatsize(newvalue)
	{
		begintxt="<font size="+newvalue+">"
		endtxt="</font>";
		dealcontent()
	}

	function dealcontent()
	{
		
		if ((document.selection)&&(document.selection.type == "Text"))
		{
		var range = document.selection.createRange();
		var ch_text=range.text;
		range.text = begintxt + ch_text + endtxt;
		} 
		else 
		{
		document.editform.content.value=begintxt+document.editform.content.value+endtxt;
		document.editform.content.focus();
		}
	}


	function gopreview()
	{
	document.preview.viewtitle.value=document.editform.title.value;
	document.preview.viewbody.value=document.editform.content.value;
	window.open('about:blank', 'winview', 'scrollbars=yes,width=500,height=400');
	document.preview.submit()
	}


	function checkform(form)
	{
		var flag=true;

		if(form("title").value==""){alert("请填入产品名称!");form("title").focus();return false;}
		return flag;
	}
	
</script>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -