📄 voteaddnew.jsp
字号:
<%@page
language="java"
contentType="text/html;charset=GBK"
%>
<%@include file="session.jsp"%>
<%@include file="/config.jsp"%>
<%@include file="/jdbc_database.jsp"%>
<%
String tempstr="";
String sqlstr="";
String sqlstr1="";
String sqlstr2="";
String title="添加投票项目";
int kk=0;
try
{
if(request.getParameter("brif0")!=null&&request.getParameter("brif1")!=null)
{
int newid=0;
sqlstr="select max(id) from vote";
result=statement.executeQuery(sqlstr);
if(result.next())
newid=result.getInt(1)+1;
int type=Integer.parseInt(request.getParameter("type"));
sqlstr1="select type from vote where type=1";
result=statement.executeQuery(sqlstr1);
if(result.next())
{if(type==1){
type=0;
kk=1;}
}
sqlstr2="select type from vote where type=2";
result=statement.executeQuery(sqlstr2);
if(result.next())
{if(type==2){
type=0;
kk=1;}
}
String newstr="";
//con.setAutoCommit(false);
for(int i=0;i<7;i++)
{
newstr=request.getParameter("brif"+i);
if(newstr.length()>0)
{
sqlstr="insert into vote values("+newid+","+type+","+i+",'"+newstr+"',0)";
statement.executeUpdate(sqlstr);
out.println(sqlstr);
}
else
{
break;
}
}
if((kk==1)){ response.sendRedirect("voteadmin.jsp?statestr=10");}
//statement.executeBatch();
//con.commit();
//con.setAutoCommit(true);
response.sendRedirect("voteadmin.jsp?statestr=5");
return;
}
%>
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<META HTTP-EQUIV="Expires" CONTENT="0">
<meta http-equiv="Cache-Control" content="no-store">
<LINK rel="stylesheet" type="text/css" href="../css/style.css">
<script language="JavaScript">
function send()
{
for(i=0;i<7;i++)
{
votecon=eval("document.form1.brif"+i+".value");
if(votecon.indexOf("\'")>=0||votecon.indexOf("\"")>=0||votecon.indexOf("<")>=0||votecon.indexOf(">")>=0)
{
//votecon=trim(votecon);
//document.form1.eval("brif"+i).value=checkstring(votecon);
alert("输入不能包含 \' \" < > 这些符号!");
return false;
}
if(votecon.length>50)
{
alert("投票介绍和各选项文字均不能超过50个汉字!");
return false;
}
}
if(document.form1.brif0.value=='')
{
alert('投票主题的简介不能为空!');
return false;
document.form1.brif0.focus();
}
else
{
if((document.form1.brif1.value=='')||(document.form1.brif2.value=='')||(document.form1.brif3.value==''))
{
alert('一个投票项目最少要有三个选项!');
return false;
}
else
{
document.form1.submit();
return true;
}
}
}
</script>
<title>添加投票项目</title>
</head>
<body class="mainBody" class="mainBody" onLoad="MM_preloadImages('../images/cancel2.gif','../images/queding2.gif')">
<!--***************************主体表格分界*****************************-->
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="35">
<tr>
<td width="25"><img src="../images/space.gif" width="25"></td>
<td width="55"><img src="../images/title_head.gif" width="55" height="35"></td>
<td width="100%" background="../images/title_bg.gif" valign="bottom"> <font size="3" face="黑体" color="#6600CC">投票设置</font>
<font size="2" class="alertColor" face="Arial, Helvetica, sans-serif">──<%=title%></font></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="16">
<tr>
<td background="../images/line_top.gif" height="16"> </td>
</tr>
</table>
<br>
<table cellspacing=1 cellpadding=0 border=0 bordercolordark=#FFFFFF width=100%>
<tr height=20>
<td><br>
<center>
<table border="1" cellpadding="4" cellspacing="1" style="border-collapse:collapse;border-color:#9DDE8E;" width="93%" bordercolorlight="#808080" bordercolordark="#D4D4D4">
<form method="post" action="voteaddnew.jsp" name="form1">
<tr>
<td width="83" nowrap class="boxHead" align="center">投票主题</td>
<td width="505" background="../images/leftbg2.gif"><input type="text" name="brif0" size=75 value=""></td>
</tr>
<tr height=20>
<td colspan=3 background="../images/leftbg2.gif" ><font color="<%=Page_warncolor%>">(投票介绍和各选项文字均不能超过50个汉字,一个投票项目最少要有三个选项!)</font></td>
</tr>
<tr height="30">
<td nowrap class="boxHead" align="center">选项1</td>
<td background="../images/leftbg2.gif"><input type="text" name="brif1" size="75"></td>
</tr>
<tr nowrap class="boxHead" height="30">
<td align="center">选项2</td>
<td background="../images/leftbg2.gif"><input type="text" name="brif2" size="75"></td>
</tr>
<tr nowrap class="boxHead" height="30">
<td align="center">选项3</td>
<td background="../images/leftbg2.gif"><input type="text" name="brif3" size="75"></td>
</tr>
<tr nowrap class="boxHead" height="30">
<td align="center">选项4</td>
<td background="../images/leftbg2.gif"><input type="text" name="brif4" size="75"></td>
</tr>
<tr nowrap class="boxHead"height="30">
<td align="center">选项5</td>
<td background="../images/leftbg2.gif"><input type="text" name="brif5" size="75"></td>
</tr>
<tr height="30">
<td nowrap class="boxHead" align="center">选项6</td>
<td background="../images/leftbg2.gif"><input type="text" name="brif6" size="75"></td>
</tr>
<tr height="30">
<td nowrap class="boxHead" align="center">类型:</td>
<td background="../images/leftbg2.gif">
<select name="type">
<option value=0 selected>暂停使用</option>
<option value=1>内网显示</option>
<option value=2>外网显示</option>
</select>
</td>
</tr>
<center>
<tr height=30>
<td colspan=3 align="center"><a href="javascript:send()"><input type=image src="/images/queding1.gif" onMouseOver="this.src='../images/queding2.gif'" onMouseOut="this.src='../images/queding1.gif'"></a> </td>
</tr>
</center>
</form>
</table>
</center>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="16">
<tr>
<td height="16" background="../images/line.gif"> </td>
</tr>
</table>
<BR>
<tr height=30 align=center>
<td align=center>
<a href="voteadmin.jsp">全部投票项目</a>
<a href="voteaddnew.jsp">新增投票项目</a>
</td>
</tr>
</table>
<!--***************************主体表格分界*****************************-->
</body>
</html>
<%
}
catch(Exception e)
{
response.sendRedirect("voteadmin.jsp?statestr=3");
return;
}
finally
{
try{
if(result!=null)
{
result.close();
result=null;
}
if(statement!=null)
{
statement.close();
statement=null;
}
if(con!=null)
{
con.close();
con=null;
}
}catch(Exception e){}
}
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -