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

📄 newadd.asp

📁 新的文章管理系统
💻 ASP
字号:
<!--#include file="head.asp"-->
<script src="ubbcode.js"></script>

<%
If Request("action") = "add" Then
	txttitle = Strcheck(Request.Form("txttitle"))
	Intime = Request.Form("year1")&"-"&Request.Form("month1")&"-"&Request.Form("day1")
	txtcontent = Strcheck(Request.Form("txtcontent"))
	key = Strcheck(Request.Form("key"))
	writer = Strcheck(Request.Form("writer"))
	writefrom = Strcheck(Request.Form("writefrom"))
	classid = Request.Form("classid")
	Nclassid = Request.Form("Nclassid")
	
	Sql = "Insert into article(content,title,Nclassid,classid,Nkey,dateandtime,writer,writefrom,author)values("
	Sql = Sql & txtcontent &","& txttitle &","& Nclassid &","& classid &","& key &",'"& Intime &"',"
	Sql = Sql & writer &","& writefrom &",'"& Session("admin") &"')"
	conn.execute(Sql)
	Response.Write "<script>alert(""发布成功"");location.href=""NewAdd.asp"";</script>"
	Response.End 
End IF

dim rs
dim sql
dim count
set rs = conn.execute("select * from ANclass order by Nclassid asc")
%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
        <%
        count = 0
        do while not rs.eof 
        %>
subcat[<%=count%>] = new Array("<%= trim(rs("Nclass"))%>","<%= trim(rs("classid"))%>","<%= trim(rs("Nclassid"))%>");
        <%
        count = count + 1
        rs.movenext
        loop
        rs.close
        %>
onecount=<%=count%>;

function changelocation(locationid)
    {
    document.myform.Nclassid.length = 0; 

    var locationid=locationid;
    var i;
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == locationid)
            { 
                document.myform.Nclassid.options[document.myform.Nclassid.length] = new Option(subcat[i][0], subcat[i][2]);
            }        
        }
        
    }    
</script>
<form method="POST" name="myform" action="?action=add" onSubmit = "return check();">
              
        <table width="100%" border="1" cellspacing="0" cellpadding="3" align="center" bordercolorlight="#cccccc" bordercolordark="#FFFFFF">
          <tr bgcolor="#eeeeee" valign="middle"> 
            <td colspan="2" align="center" height="25">添 加 文 章</td>
          </tr>
          <tr> 
            <td width="15%" align="left" valign="middle" height="20">文章类型:</td>
            <td width="85%"> 
              <%
					set rs = conn.execute("select * from Aclass")
					if rs.eof and rs.bof then
						response.write "请先添加栏目。"
						response.end
					else
					%>
              <select name="classid" onChange="changelocation(document.myform.classid.options[document.myform.classid.selectedIndex].value)" size="1">
                <%do while not rs.eof%>
                <option selected value="<%=trim(rs("classid"))%>"><%=trim(rs("class"))%></option>
                <%
        				rs.movenext
       					loop
						end if
       					rs.close
        				set rs = nothing
        				conn.Close
        				set conn = nothing
						%>
              </select>
              <select name="Nclassid">
                <option selected value="">==请选栏目==</option>
              </select>
              ** </td>
          </tr>
          <tr> 
            <td width="15%" align="left" height="30" valign="middle">文章标题:</td>
            <td width="85%" height="30"> 
              <input type="text" name="txttitle" size="70"
          class="smallinput" maxlength="100">
            </td>
          </tr>
          <tr> 
            <td width="15%" align="left" height="30" valign="middle">UBB&nbsp;标签:</td>
            <td width="85%" height="30"> 
              <!--#include file="getUbb.asp" -->
            </td>
          </tr>
          <tr> 
            <td width="15%" align="left" valign="middle">发布日期:</td>
            <td width="85%"> 
              <select name="year1">
                <option value="<%=year(Now())%>" selected><%=year(Now())%></option>
                <%
					for i=2001 to 2005
						response.write "<option value='"&i&"'>"&i&"</option>"
					next
					%>
              </select>
              <select name="month1">
                <option value="<%=month(Now())%>" selected><%=month(Now())%></option>
                <%
					for i=1 to 12
						response.write "<option value='"&i&"'>"&i&"</option>"
					next
					%>
              </select>
              <select name="day1">
                <option value="<%=day(Now())%>" selected><%=day(Now())%></option>
                <%
					for i=1 to 31
						response.write "<option value='"&i&"'>"&i&"</option>"
					next
					%>
              </select>
              日 </td>
          </tr>
          <tr> 
            <td width="15%" align="left" valign="middle">文章内容:</td>
            <td width="85%"> 
              <textarea rows="15" name="txtcontent" cols="60" class="smallarea"></textarea>
            </td>
          </tr>
          <tr> 
            <td width="15%" align="left" height="30" valign="middle">相关文章:</td>
            <td width="85%" height="30"> 
              <input type="text" name="key" size="70"
          class="smallinput" maxlength="100">
            </td>
          </tr>
          <tr> 
            <td width="15%" align="left" height="30" valign="middle">作&nbsp;&nbsp;&nbsp;&nbsp;者:</td>
            <td width="85%" height="30"> 
              <input type="text" name="writer" size="70"
          class="smallinput" maxlength="100">
            </td>
          </tr>
          <tr> 
            <td width="15%" align="left" height="30" valign="middle">来&nbsp;&nbsp;&nbsp;&nbsp;源:</td>
            <td width="85%" height="30"> 
              <input type="text" name="writefrom" size="70"
          class="smallinput" maxlength="100">
            </td>
          </tr>
          <tr> 
            <td colspan="2" align="center" height="30"> 
              <input type="submit" value=" 添 加 "
  name="cmdok" class="buttonface">
              &nbsp; 
              <input type="reset" value=" 清 除 "
  name="cmdcancel" class="buttonface">
            </td>
          </tr>
        </table>
			    </form>

<script language="JavaScript">
function check(){
if (myform.Nclassid.value ==""){
alert("请选择小栏目");
myform.Nclassid.focus();
return false;
}
if (myform.txttitle.value ==""){
alert("请输入文章标题");
myform.txttitle.focus();
return false;
}
if (myform.txtcontent.value ==""){
alert("请输入文章内容");
myform.txtcontent.focus();
return false;
}
return true;
}
</script>
<!--#include file="copy.asp"-->

⌨️ 快捷键说明

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