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

📄 miscell_edit.asp

📁 ASP网页
💻 ASP
字号:
<%@ Language=VBScript%>
<%
Response.Buffer=true
Response.Expires=0
if Session("userqx")>="1" and  Session("userqx")<="9" then
else
	Response.Redirect "../warn.asp"
end if
%>
<!-- #include file="../dsn.asp" -->
<%
keyno=Request.QueryString("keyno")
if keyno="" then keyno="0"

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

htmlname="miscell_edit.asp?keyno="+keyno+"&classcode="+classcode+"&pageno="+pageno+"&ordername="+ordername+"&byasc="+byasc
backhtml="miscell_admin.asp?classcode="+classcode+"&pageno="+pageno+"&ordername="+ordername+"&byasc="+byasc
tablename="miscell"	
enflag="1"

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

sqltext="select * from miscell_class where classcode='"+classcode+"'"
rs.Open sqltext,cn,1,1
if not rs.EOF then
	classcode=rs("classcode")
	classname=trim(rs("classname"))
	basclass=trim(rs("basclass"))
	qxflag=trim(rs("qxflag"))
else
	Response.End	
end if	
rs.Close
%>
<html>
<head>
<title>网站资料</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {font-size: 12px; color: #000; font-family: 宋体}
td {font-size: 12px; color: #000; font-family: 宋体;line-height:130%}

.t1 {font:12px 宋体;color=000000} 
.t2 {font:12px 宋体;color:ffffff} 
.t3 {font:12px 宋体;color:336699} 
.t4 {font:12px 宋体;color:ff0000} 
.bt1 {font:14px 宋体;color=000000} 
.bt2 {font:14px 宋体;color:ffffff} 
.bt3 {font:14px 宋体;color:336699} 
.bt4 {font:bold 16px 宋体;color:maroon} 

.td1 {font-size:12px;line-height:20px;text-align:right;background-color:#ffffff;color:#000000}
.td2 {font-size:12px;line-height:20px;text-align:left;background-color:#ffffff;color:#000000;}
.td3 {font-size:12px;line-height:20px;text-align:left;background-color:#ffffff;color:#000000;}

A:link {color: #000077}
A:visited {color: #000077}
A:hover {color: #ff0000}
-->
</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
	bz=0
	keyno=Request.QueryString("keyno")
	sortnum=Request.Form("sortnum")
	title=trim(Request.Form("title"))

	if bz=0 then
		 if keyno="0" then
			sqltext="select top 1 keyno from "+tablename+" order by keyno desc"
			rs.Open sqltext,cn,1,1
			if rs.EOF then
				keyno=1
			else
				keyno=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("keyno")=keyno
			rs("creadate")=Now()
			rs("classcode")=classcode
			rs("basclass")=basclass
			rs("querycount")=0
			rs("querycount2")=0
		else	
			rs.Open "select * from "+tablename+" where keyno="&keyno,cn,3,3
		end if	
		if isnumeric(sortnum) then
			rs("sortnum")=sortnum
		end if	
		rs("title")=title
		rs("flag")=trim(Request.Form("flag"))
		rs("nomflag")=trim(Request.Form("nomflag"))
		rs("keyword")=trim(Request.Form("keyword"))
		rs("website")=trim(Request.Form("website"))
		rs("content")=trim(Request.Form("content"))
		if enflag="1" then
			rs("title2")=trim(Request.Form("title2"))
			rs("keyword2")=trim(Request.Form("keyword2"))
			rs("content2")=trim(Request.Form("content2"))
		end if
		rs("updatetime")=now()
		
		rs.Update
		Response.Write("<script language=Javascript>")
		Response.Write("window.location.href='"+backhtml+"'")
		Response.Write("</script>")
		
	end if
else
	if keyno="0" then
		flag="1"
		nomflag="0"
		creadate=now()
		updatetime=now()
		querycount=0
		querycount2=0
	else
		sqltext="select * from "+tablename+" where keyno="&keyno
		rs.Open sqltext,cn,1,1
		sortnum=rs("sortnum")
		title=trim(rs("title"))
		keyword=trim(rs("keyword"))
		website=trim(rs("website"))
		basclass=trim(rs("basclass"))
		content=trim(rs("content"))
		flag=trim(rs("flag"))
		nomflag=trim(rs("nomflag"))
		creadate=rs("creadate")
		updatetime=rs("updatetime")
		querycount=rs("querycount")

		title2=trim(rs("title2"))
		keyword2=trim(rs("keyword2"))
		content2=trim(rs("content2"))
		querycount2=rs("querycount2")
	end if
end if	

if bz=1 or bz=2 or bz=3 then
	if mid(qxflag,4,1)="0" or (Session("username")="xu256" and Session("userqx")="9") then
		keystate=""
	else
		keystate="readonly"
	end if	
 %>
 
 <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr><td>
	<%if seekname="" then%>
		当前位置:<b><%=classname%></b> ←
	<%end if%>	
		<a href="<%=backhtml%>">返回列表</a></td></tr>
	<tr><td><hr size=1></td></tr>
	<tr bgcolor=#527c72><td height=20><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><input type="text" value="<%=sortnum%>" name=sortnum maxlength=10 size=4 <%=keystate%>>
		&nbsp;创建日期:<font color=000000><%=creadate%></font>
		&nbsp;更新日期:<font color=000000><%=updatetime%></font>
		<%if mid(qxflag,1,1)="1" then%>
		&nbsp;点击<font color=ff6600><%=querycount+querycount2%></font>次
		<%end if%>
		
		</td></tr>
	<%if mid(qxflag,2,1)="1" then%>
	<tr><td width=70 align=right>是否显示:</td>
		<td>
			<input type=radio name=flag value="1" <%if flag="1" then Response.Write("checked")%>>显示
			<input type=radio name=flag value="0" <%if flag="0" then Response.Write("checked")%>>不显示
		</td></tr>
	<%else%>
		<input type=hidden name=flag value='<%=flag%>'>	
	<%end if%>
	<%if mid(qxflag,3,1)="1" then%>
	<tr><td width=70 align=right>是否推荐:</td>
		<td>
			<input type=radio name=nomflag value="0" <%if nomflag="0" then Response.Write("checked")%>>不推荐
			<input type=radio name=nomflag value="1" <%if nomflag="1" then Response.Write("checked")%>>推荐
		</td></tr>
	<%else%>
		<input type=hidden name=nomflag value='<%=nomflag%>'>	
	<%end if%>
	
	<tr><td width=70 align=right>标题名称:</td>
		<td><input type="text" value="<%=title%>" name=title maxlength=60 size=56><font color=red>*</font></td></tr>
	<%if enflag="1" then%>
	<tr><td width=70 align=right>标题(英):</td>
		<td><input type="text" value="<%=title2%>" name=title2 maxlength=120 size=56></td></tr>
	<%end if%>
	<%
	if classcode="999" then
	%>		
	<tr><td width=70 align=right>栏目类型</td>
		<td><input type="text" value="<%=keyword%>" name=keyword maxlength=60 size=40 <%=keystate%>></td></tr>
		<input type="hidden" name=keyword2 value="<%=keyword2%>">
	<%
	 else
		if mid(qxflag,8,1)="1"	then
	%>
	<tr><td width=70 align=right>关键字</td>
		<td><input type="text" value="<%=keyword%>" name=keyword maxlength=60 size=40>请用“/”隔开,最多填三个关键词</td></tr>
	<%if enflag="1" then%>
	<tr><td width=70 align=right>(英文)</td>
		<td><input type="text" value="<%=keyword2%>" name=keyword2 maxlength=60 size=40></td></tr>
	<%end if%>
	<%	
		else
	%>	
		<input type="hidden" name=keyword value="<%=keyword%>">
		<input type="hidden" name=keyword2 value="<%=keyword2%>">
	<%	
		end if
	 end if
	%>	
	<%if mid(qxflag,5,1)="1" then%>		
	<tr><td width=70 align=right>链接网址</td>
		<td><input type="text" value="<%=website%>" name=website maxlength=60 size=40>
		</td>
	</tr>
		<input type="hidden" name=content value="<%=content%>">	
		<input type="hidden" name=content2 value="<%=content2%>">	
	<%
	else%>
		<input type="hidden" name=website value="<%=website%>">	
	<tr><td width=70 align=right></td>
		<td>
			<img src="images\bold.gif" onclick="format('bold')" style="cursor:hand;" title="粗体">
			<img src="images\italicize.gif" onclick="format('italic')" style="cursor:hand;" title="斜体">
			<img src="images\underline.gif"  onclick="format('underline')" style="cursor:hand;" title="下划线">
			<img src="images\center.gif"  onclick="format('center')" style="cursor:hand;" title="居中">
			<img src="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=12 cols=66 name=content style="font-family:宋体" ><%=content%></textarea></td>
	</tr>
	<%if enflag="1" then%>
	<tr><td width=70 align=right>内容(英):</td>
		<td><textarea rows=12 cols=66 name=content2 style="font-family:宋体" ><%=content2%></textarea></td>
	</tr>
	<%end if%>
	<%end if%>	
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr><td width=150 align=right height=40></td>
		<td><input type="submit" name="submit" value="确认提交">&nbsp;&nbsp;&nbsp;&nbsp;
		</td>
	</tr>
</form>
</table>	
<script language=Javascript>
	editform.title.focus()
</script>
<%
end if
%>
<form name=preview method=post action="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('content_view.asp', '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 + -