📄 addnews.jsp
字号:
<%@ page contentType="text/html; charset=gb2312"%>
<%@page import="
java.sql.*,
javax.sql.*,
javax.naming.*,
com.aheadedu.fen.bean.*,
com.aheadedu.fen.service.*"
%>
<html>
<head>
<title>添加新闻</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
NewsService ns=new NewsService("jdbc/news");
Connection con=ns.getCon();
Statement stmt=con.createStatement();
// Statement stmt2=con.createStatement();
ResultSet rs=stmt.executeQuery("select kindid,kindname from new_kind order by kindid");
// ResultSet rs2=stmt2.executeQuery("select title from news order by pub_time desc limit 10");
%>
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
.STYLE2 {font-size: 12px}
.STYLE3 {color: #3366FF}
-->
</style>
<script language="javascript">
function check(myForm){
if(myForm.title.value==''){
alert('标题不能为空.');
return false;
}
if((myForm.content.value).length<3){
alert('内容不可少于3个字.');
return false;
}}
</script>
</head>
<body>
<form name="form1" onSubmit="javascript:return check(this);" method="post" action="addnewsproc.jsp" enctype="multipart/form-data">
<table width="436" height="350" border="0" align="center">
<tr>
<td width="50" height="33">标题</td>
<td width="376"><input name="title" type="text" id="title" size="50"> </tr>
<tr>
<td height="24">分类</td>
<td><select name="kind" size="1" id="kind">
<%
while(rs.next()){
%>
<option value="<%=rs.getString("kindID")%>"><%=rs.getString("kindname")%></option>
<%
}
%>
</select>
<label></label></td>
</tr>
<tr>
<td height="165" valign="top">内容</td>
<td align="left" valign="top"><textarea name="content" cols="50" rows="10"></textarea></td>
</tr>
<tr>
<td height="21" valign="top">附件</td>
<td><label></label>
<table width="185%" border="0" id="tb">
<tr>
<td width="50%"><input name="file" type="file" size="29"></td>
</tr>
<tr> </tr><td>
</td>
</tr>
</table></td>
</tr>
<tr>
<td height="15"> </td>
<td><a href="javascript:addRow()" class="STYLE2">再来一个</a>(<span class="STYLE3">上传格式≠bat,jsp,htm,exe (总大小<20M)</span>)</td>
</tr>
<tr>
<td height="24"> </td>
<td><select name="ispub">
<option value="0">不发表</option>
<option value="1" selected="selected">发表</option>
</select> </td>
</tr>
<tr>
<td height="23"> </td>
<td><input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit2" value="重置"></td>
</tr>
</table>
</form>
</body>
<%
con.close();
%>
<script type="text/javascript">
function addRow(){
var newTr = tb.insertRow();
var newTd0 = newTr.insertCell();
//var newTd1 = newTr.insertCell();
newTd0.innerHTML = '<input type="file" name="file" size="29">';
//newTd1.innerText= '';
}
</script>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -