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

📄 news_edit.asp

📁 OFFICE办公自动化
💻 ASP
字号:
<%
'功能:编辑新闻
'参数:	request.form("addedit_subed")="true"#表单提交; request("Style")=int #当前栏目; request("page")=int #当前页码
'	request("id")=int #新闻ID;
%>

<!--#include file="../inc/Secure.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/Const.asp"-->

<%
'response.buffer=false

'------------------------------------------------设置参数
LoginID=trim(session("LoginID")) : if LoginID="" then LoginID=0 '当前用户ID
currentpage=request("page") : if currentpage="" then currentpage=1 '当前页码
Style=request("Style"):if Style="" then Style=0 '当前栏目
id=request("id") '新闻ID
'------------------------------------------------
'------------------------------------------------编辑记录
table="tbioaInfomation" '表名
if request.form("addedit_subed")="true" then 
'表单提交后
	Title=Request.Form("Title")'标题
	'content=Request.Form("content")'内容
	for i = 1 to request.form("content").count 
	content = content & request.form("content")(i)
	next
	newsort=Request.Form("newsort")'栏目
	
	'编辑时使用的字段
	field1=array("newsort","Title","content")
	value1=array(newsort,Title,content)
	sql="UPDATE " & table & " SET "
	for i=0 to ubound(field1)
		sql = sql & field1(i) & "='" & replace(value1(i),"'","''") & "'" 
		if i <> ubound(field1) then sql=sql & ","  else  sql=sql & " where id=" & id 
	next
	oConn.Execute sql

	word="<p>新闻信息已修改成功!</p><p><img border=0 src=../images/icon_show.gif align=left width=16 height=16><a href=news_manage_list.asp?Style="&Style&"&page="&currentpage&">返回新闻列表</a>"
end if
'--------------------------------------------取记录
'取新闻记录 (返回rs对象)
	set rs=Server.CreateObject("ADODB.RecordSet")
	sql="select * from " & table & " where ID="&id
	rs.open sql,oConn,1,1
'--------------------------------------------
%>


<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../css/main.css" type=text/css>
<title>main</title>
<base target="FrmMain">
<script src="../js/front_chec.js"></script>
<script language="JavaScript">
<!--
 function require(form){
	if (!checnull(form.Title,"请填写新闻标题!")) return false;
	form.content.value=editor.save()
	BreakItUp(form,"content")
	if (form.content.value=="") {alert("请填写新闻内容!"); return false;}
 }
 
 function BreakItUp(form,content)
 {
  var FormLimit = 102399
  
  var TempVar = new String
  TempVar = form.content.value
  if (TempVar.length > FormLimit)
  {
   form.content.value = TempVar.substr(0, FormLimit)
   TempVar = TempVar.substr(FormLimit)
   while (TempVar.length > 0)
   {
    var objHidden = document.createElement("textarea")
    objHidden.name = "content"
    objHidden.style.display="none"
    objHidden.value = TempVar.substr(0, FormLimit)
    form.appendChild(objHidden)
    TempVar = TempVar.substr(FormLimit)
   }
  }
 }
-->
</script>
</head>

<body topmargin="10" leftmargin="10">

<!--#include file="news_manage_menu.htm"-->

<hr width="100%" size=1 color="#000000">
<br>

<div align="center">
<table width="600" cellspacing="1" cellpadding="2" class="tab">
  <tr>
    <td width="100%" class="tdTop">
      <table border="0" width="100%" cellspacing="0" cellpadding="0">
        <tr>
          <td class="tdTop">
            <p align="left"><img border="0" src="../images/icon_title.gif" align="left">发布新闻</p>
          </td>
          <td width="120" class="tdTop">
            <p align="left"><img border="0" src="../images/icon_return.gif" align="left">  
            <a href="news_manage_list.asp?Style=<%=Style%>&page=<%=currentpage%>" class="linkTop">返回新闻列表</a></p>    
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="25%" class="td1">
    
    <% if request.form("addedit_subed")="true" then %>
      <table border="0" width="100%" cellspacing="10" cellpadding="0">
        <tr>
          <td width="36%">
            <p align="right"><img border="0" src="../images/edit.gif" width="32" height="32">
          </td>
          <td width="64%"><p> </p>
            <%=word%>
          </td>
        </tr>
        <tr>
          <td width="100%" colspan="2">
          </td>
        </tr>
      </table> 
    <% else %>
    <form name="eventfrm" method="POST" action="?id=<%=id%>&Style=<%=Style%>&page=<%=currentpage%>" onSubmit="return require(this)">
      <input type=hidden name="addedit_subed" value="true">
      <table border="0" width="100%" cellspacing="10" cellpadding="0">
        <tr>
          <td width="100%">新闻栏目: 
		<%
		set rs_style=server.CreateObject("adodb.recordset")
		rs_style.Open "select * from tbioaInfoStyle",oConn,1,1
		%>
		<select name="newsort" size=1 class=fstyle style="WIDTH:135">
		<%while not rs_style.EOF '循环%>
		<option value="<%=rs_style("ID")%>" <%if rs_style("ID")=rs("newsort") then response.write("selected")%>><%=rs_style("newsort")%></option>
		<%rs_style.MoveNext: wend%>
		</select>
		<%rs_style.close%>
		 (如果不移动新闻到其他栏目,请不要改变该选项。)
          </td>
        </tr>
        <tr>
          <td width="100%">新闻标题: <input type="text" name="Title" size="40" maxlength="200" value="<%=Server.HTMLEncode(rs("title"))%>" class="input"> <font COLOR="RED">*</font>
          </td>
        </tr>
        <tr>
          <td width="100%">新闻内容: <font COLOR="RED">*</font><br>
            <input type=hidden name="content" value="">
            <iframe id="editor" src="../inc/editor.asp?edit=select content from tbioaInfomation where ID=<%=id%>" width="100%" height="400" scrolling="yes" style="border: 1 solid #000000"></iframe>
          </td>
        </tr>
        <tr>
          <td width="100%">
           <input type="submit" value="确定" name="B1" class="button0" onmouseout=className="button0" onmouseover=className="button1"> <input type="reset" value="全部重写" name="B2" class="button0" onmouseout=className="button0" onmouseover=className="button1">
          </td>
        </tr>
      </table>
    </form>
    <% end if %>
    
    </td>
  </tr>
  <tr>
    <td width="25%" class="tdBottom">
    </td>
  </tr>
</table>
</div>
</body>

</html>

<%'释放对象变量
rs.close
oConn.close
%> 

⌨️ 快捷键说明

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