📄 public_instance_edit.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" -->
<%
htmltitle=Request.QueryString("title")
tablename=Request.QueryString("tablename")
pageno=Request.QueryString("pageno")
keyno=Request.QueryString("keyno")
if keyno="" then keyno="0"
htmlname="public_instance_edit.asp?title="+htmltitle+"&tablename="+tablename+"&pageno="+pageno+"&keyno="+keyno
backhtml="public_instance.asp?title="+htmltitle+"&tablename="+tablename
%>
<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">
<%
set cn=server.CreateObject("ADODB.Connection")
cn.Open mycnstr
set rs=server.CreateObject("ADODB.Recordset")
if Request.ServerVariables("REQUEST_METHOD")="POST" then
sortnum=Request.Form("sortnum")
if keyno="0" then
if sortnum="" or not isnumeric(sortnum) then
sqltext="select top 1 sortnum from "+tablename+" order by sortnum desc"
rs.Open sqltext,cn,1,1
if not rs.EOF then
sortnum=rs(0)+1
else
sortnum=1
end if
rs.Close
end if
sqltext="select top 1 classcode from "+tablename+" order by classcode desc"
rs.Open sqltext,cn,1,1
if not rs.EOF then
keyno=rs(0)+1
else
keyno="101"
end if
rs.Close
rs.Open tablename,cn,3,3
rs.AddNew
rs("classcode")=keyno
else
sqltext="select * from "+tablename+" where classcode='"+keyno+"'"
rs.Open sqltext,cn,3,3
end if
if isnumeric(sortnum) then
rs("sortnum")=sortnum
end if
rs("classname")=trim(Request.Form("title"))
rs("content")=trim(Request.Form("content"))
rs.Update
Response.Write("<script language=Javascript>")
Response.Write("window.location.href='"+backhtml+"'")
Response.Write("</script>")
else
if keyno<>"0" then
sqltext="select * from "+tablename+" where classcode='"+keyno+"'"
rs.Open sqltext,cn,1,1
sortnum=rs("sortnum")
title=trim(rs("classname"))
content=trim(rs("content"))
end if
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td>
<b><%=htmltitle%></b> ← <a href="<%=backhtml%>">返回列表</a>
</td></tr>
<tr><td height=5></td></tr>
<tr bgcolor=ffe4c4><td height=20><font class=t1>具体内容</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=5 >
</td></tr>
<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>
<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>
</td></tr>
<tr><td width=70 align=right>内容</td>
<td><textarea rows=15 cols=70 name=content style="font-family:宋体" ><%=content%></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="确认提交">
<input type=button value='内容预览' name=Button onclick=gopreview() style="">
</td></tr>
</table>
<script language=Javascript>
form1.title.focus()
</script>
<%end if%>
</form>
<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=" ";
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("classname").value==""){alert("请填入标题名称!");form("classname").focus();return false;}
if (flag==true) {flag=checkchar(form("content").value)}
if (flag==true) {flag=checkchar(form("education").value)}
return flag;
}
function checkchar(str)
{
str=str.toLowerCase()
if (str.search("<"+"%")>0)
{
window.alert("("+str+")中有非法字符,请检查!")
return false;
}
if (str.search("<scrip"+"t")>0)
{
window.alert("("+str+")中有非法字符,请检查!")
return false;
}
return true;
}
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -