news_add_1.jsp
上传用户:zdly666
上传日期:2022-08-09
资源大小:6511k
文件大小:3k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

JavaScript

  1. <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
  2. <%@ include file="conn.jsp"%>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml">
  5. <head>
  6. <%
  7. if(session.getAttribute("adminname")==null)
  8. {response.sendRedirect("sorry.jsp");}
  9. %>
  10. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  11. <title>文件添加</title>
  12. <script language="JavaScript">
  13. function YanZheng()
  14. {
  15. if (myform.Column_ID.value=="")
  16. {alert("请选择栏目类别!");myform.Column_ID.focus();return false}
  17. if (myform.Title.value=="")
  18. {alert("标题不能为空!");myform.Title.focus();return false}
  19. if (myform.Synopsis.value=="")
  20. {alert("简介不能为空");myform.Synopsis.focus();return false}
  21. if (myform.Introduce.value=="")
  22. {alert("详细介绍不能为空");myform.Introduce.focus();return false}
  23. if (myform.File.value=="")
  24. {
  25. alert("请上传文件!!");
  26. myform.File.focus();
  27. return false;
  28. }else{
  29. str = myform.File.value;
  30. strs = str.toLowerCase();
  31. lens = strs.length;
  32. extname = strs.substring(lens-4,lens);
  33. if(extname!=".jpg" && extname!=".gif"&& extname!=".avi" && extname!=".wmv" && extname!=".rar"&& extname!=".doc"&& extname!=".txt")
  34. {
  35. alert("请选择正确的文件上传!");
  36. return false;
  37. }
  38. }
  39. }
  40. </script>
  41. </head>
  42. <body background="img/beijing.gif">
  43. <jsp:include page="Menu.jsp" flush="true"/>
  44. <br>
  45. <form name="myform" method="post" action="Operate_File.jsp?EditType=fileAdd" enctype="multipart/form-data" onSubmit="return YanZheng()">
  46.   <table width="100%" height="240" border="0" align="center" cellpadding="2" cellspacing="1">
  47.     <tr> 
  48.       <td height="25" colspan="2"><div align="center"><strong>添加文件</strong></div></td>
  49.     </tr>
  50.     <tr> 
  51.       <td height="25"><div align="right">栏目:</div></td>
  52.       <td height="25">
  53. <% 
  54. String columnSQL="select * from S_fileColumn";
  55. rs=stmt.executeQuery(columnSQL);
  56. %>
  57. <select name="Column_ID">
  58. <option value="">请选择类别</option>
  59. <%
  60. rs.beforeFirst();
  61. while (rs.next())
  62. %>
  63. <option value=<%=rs.getInt("column_id")%>><%=rs.getString("column_name")%></option>
  64. <%
  65. }
  66. rs.close();
  67. rs=null;
  68. stmt.close(); 
  69. conn.close();
  70. %>
  71. </select>   
  72.   </td>
  73.     </tr>
  74.     <tr> 
  75.       <td width="275" height="33" align="right" valign="middle">标题:</td>
  76.       <td width="689"><input name="Title" type="text" value="" size="50"></td>
  77.     </tr>
  78.     <tr> 
  79.       <td width="275" height="33" align="right" valign="middle">简要介绍:</td>
  80.       <td width="689"><input name="Synopsis" type="text" size="50" maxlength="80"></td>
  81.     </tr>
  82.     <tr> 
  83.       <td width="275" height="33" align="right" valign="middle">详细介绍:</td>
  84.       <td width="689"><textarea name="Introduce" cols="48" rows="5"></textarea></td>
  85.     </tr>
  86.     <tr> 
  87.       <td width="275" height="33" align="right" valign="middle">上传文件:</td>
  88.       <td width="689"><input name="File" type="file" value="" size="40"></td>
  89.     </tr>
  90.     <tr> 
  91.       <td height="24" colspan="2" align="right" valign="middle"> <div align="center">
  92.         <input type="submit" name="Submit1" value=" 确 定 "> 
  93.         <input type="reset" name="Submit2" value="重置" >      
  94.       </div></td>
  95.     </tr>
  96.     <tr> 
  97.       <td height="25" colspan="2" align="right" valign="middle"><a href="news.jsp">返回个人相册</a></tr>
  98.     </tr>
  99.   </table>
  100. </form>
  101. </body>
  102. </html>