具体代码如下:
<%@ page contentType="text/html;charset=gb2312"
%>
<%@ page import="java.sql.*"%>
<%@ page import="java.util.*"%>
<jsp:useBean id="con"
scope="session"
class="db.AccessBean"/>
<link rel="stylesheet"
type="text/css"
href="ndxd/css.css">
<html>
<center>
插入新题
<hr>
<script language="JavaScript">
<!--
function checkSubmit(){
if(document.insform.title.value==""
{
alert("请输入标题"
;
return false;
}
else
if(document.insform.A.value==""
{
alert("请输入A项"
;
return false;
}
else
if(document.insform.Ascore.value==""
{
alert("请分配分数"
;
return false;
}
else
if(document.insform.B.value==""
{
alert("请输入B项"
;
return false;
}
else
if(document.insform.Bscore.value==""
{
alert("请分配分数"
;
return false;
}
else
if(document.insform.C.value==""
{
alert("请输入C项"
;
return false;
}
else
if(document.insform.Cscore.value==""
{
alert("请分配分数"
;
return false;
}
else
if(document.insform.D.value==""
{
alert("请输入D项"
;
return false;
}
else
if(document.insform.Dscore.value==""
{
alert("请分配分数"
;
return false;
}
insform.submit();
}
function addText(value){
var form=document.getElementById("insform"
;
if(value=="SAS测评量表"||value=="SDS测评量表"
{
form.removeChild(document.getElementsByName("E"
[0]);
form.removeChild(document.getElementsByName("EScore"
[0]);
}
}
-->
</script>
<%
String adminName = (String)session.getAttribute("AdminName"
;
String adminPassword = (String)session.getAttribute("AdminPassword"
;
if(adminName==null||adminPassword==null){
response.sendRedirect("adminlogin.jsp"
;
}
%>
<form name="insform"
id="insform"
action="insques.jsp"
method="post"
>
<table>
<tr>
<td height="20">题目名称</td>
<td><input type="text"
name="title"></td>
</tr>
<tr>
<td>
试题种类
</td>
<td height="22"
colspan="2">
<select name=mykm id=mynum size=""
onchange="addText(this.value)"
>
<%
request.setCharacterEncoding("GBK"
;
ResultSet rs = con.query("select distinct mytype from type2"
;
if(rs.wasNull()){
out.print("<script language=javascript> alert('对不起暂无可测评科目!');
window.navigate('index.htm');</script>"
;
rs.close();
}else
{
while(rs.next()){
%>
<%
String typename = rs.getString("mytype"
;
// int id = rs.getInt("id"
;
%>
<option id=<%=typename%> value=<%=typename%>><%=typename%></option>
<%
}
rs.close();
}
%>
</select></td>
</tr>
<tr>
<td>A 项:</td>
<td><input type="text"
name="A"></td>
</tr>
<tr>
<td>分配分数</td>
<td><input type="text"
name="Ascore"
onpropertychange="
if(//D/.test(value))value=value.replace(//D/g,'')"
></td>
</tr>
<tr>
<td>B 项:</td>
<td><input type="text"
name="B"></td>
</tr>
<tr>
<td>分配分数</td>
<td><input type="text"
name="Bscore"
onpropertychange="
if(//D/.test(value))value=value.replace(//D/g,'')"
></td>
</tr>
<tr>
<td>C 项:</td>
<td><input type="text"
name="C"></td>
</tr>
<tr>
<td>分配分数</td>
<td><input type="text"
name="Cscore"
onpropertychange="
if(//D/.test(value))value=value.replace(//D/g,'')"></td>
</tr>
<tr>
<td>D 项:</td>
<td><input type="text"
name="D"
></td>
</tr>
<tr>
<td>分配分数</td>
<td><input type="text"
name="Dscore"
onpropertychange="
if(//D/.test(value))value=value.replace(//D/g,'')"
></td>
</tr>
<tr>
<td>E 项:</td>
<td><input type="text"
name="E"
></td>
</tr>
<tr>
<td>分配分数</td>
<td><input type="text"
name="Escore"
onpropertychange="
if(//D/.test(value))value=value.replace(//D/g,'')"
></td>
</tr>
</table>
<input type = "button"
value = "确定"
onclick="return checkSubmit()">
<input type = "reset"
value="取消">
</form>
</center>
</html>
欢迎光临