<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!--#include file="fckeditor/fckeditor.asp"-->
<!--#include file="conn.asp"-->
<%
dim cls
if session("admin")="" then
	Response.Redirect("admin.asp")	
end if
%>
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from news",conn,1,1
if rs.eof then
      mcount=1
else
      mcount=2
end if

rs.close
set rs=nothing


if request.QueryString("action")="save" then


Content=Request("mytext")


if Content="" then
   response.Write("<script language=javascript>alert('内容不能为空！');history.go(-1); </script>")
   response.End()
end if

set rs=server.CreateObject("adodb.recordset")
    rs.open "select * from news",conn,1,3
    rs.addnew 
 
rs("title")=trim(request("newsname"))
rs("zuozh")=trim(request("addname"))
rs("myid") = "公告"

rs("mytext")=content

rs("date")=date()
rs.update
rs.close
set rs=nothing
response.write "<script language=javascript>alert('添加成功！');location.href='Announcement.asp'; </script>"
response.End
end if
%>

<head>
<script language="javascript">
function checkdata(){
if(form11.newsname.value==""){
     form11.newsname.focus();
	 form11.newsname.select();
     alert("标题不能为空");
}
else if(form11.myselect.value==""){
     form11.myselect.focus();
     alert("选项不能为空");
}
else{
	return true;
}
	return false;
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="images/css.css" rel="stylesheet" type="text/css">
</head>
<body>

<div style="border: 1px solid #6699CC; margin-top:20px; width:90%; margin-left:7%; margin-right:auto;">
<table class="tableBorder" width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
<tr> 
<td  align="center" background="images/admin_bg_1.gif" height="25"><b><font color="#ffffff">公告添加</font></b></td>
</tr>
<tr> 
<td valign="top"> 
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#FBF4F4">
        <form name="form11" method="post" action="?action=save" onSubmit="return checkdata()">
          <tr > 
            <td width="30%" align="right">主题：</td>
            <td width="70%" style="PADDING-LEFT: 10px"> <input name="newsname" type="text" id="newsname" size="30">            </td>
          </tr>
          <tr > 
            <td align="right">发 表 人：</td>
            <td style="PADDING-LEFT: 10px"> <input name="addname" type="text" id="addname" size="30">
   </td>
          </tr>
          <tr > 
            <td align="right" valign="top">内容：</td>
            <td bgcolor="#FBF4F4" class="forumRowHighlight"style="PADDING-LEFT: 10px">
<!--在线编辑器-->
<div style="width:600px; height:400px;">
<%
Dim moFCKeditor
Set moFCKeditor = New FCKeditor
moFCKeditor.ToolbarSet = "Default"
moFCKeditor.Width = "100%"
moFCKeditor.Height = "400"
moFCKeditor.Value = ""
moFCKeditor.Create "mytext"
%>
</div>
<!---------------------->			</td>
          </tr>
          <tr > 
            <td height="30"></td>
            <td height="30" style="PADDING-LEFT: 10px"> <input type="submit" name="Submit" value="提交发表"> 
              <input type=reset name="Clear" value="重新填写"></td>
          </tr>
        </form>
      </table>
</td>
</tr>
</table>
</div>
<!--#include file="foot.asp"-->
</body>
</html>
