看看你说话的口气,像是有求于人吗?
给你个我以前写的,看得上就自己改改!
<html>
<script language=javascript>blm=0</script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>选择题添加</title>
<style>
.text {
font-family: "宋体";
font-size: 9pt;
line-height: 150%;
}
.dshadow {
filter: DropShadow(Color=#000000, OffX=1, OffY=1);
font-family: "宋体";
font-size: 9pt;
color: #E3E3C8;
}
.allborder {
border: 1px solid #000000;
font-family: "宋体";
font-size: 9pt;}
.tbborder {
border-top: 1px solid #000000;
border-bottom: 1px solid #000000;
}
a:link {
font-family: "宋体";
font-size: 9pt;
color: #5B5C3D;
text-decoration: none;
}
a:visited {
font-family: "宋体";
font-size: 9pt;
color: #5B5C3D;
text-decoration: underline;
}
a:hover {
font-family: "宋体";
font-size: 9pt;
color: #848435;
text-decoration: underline overline;
}
body {
background-color: #d3d3a9;
font-size: 13px;}
.inp {
font-family: "宋体";
font-size: 9pt;
height:16px;
border:0px;
border-bottom: 1px solid #000000;
background-color: #D3D3A9;
}
.but {
font-family: "宋体";
font-size: 9pt;
border: 0px;
background-color: #D3D3A9;
cursor: hand;
}
label {
cursor: hand;
}
</style>
<script language="JavaScript">
/*------选择题->单空选择题出题版块使用js文件!------*/
/*----------Edit By 心云意水 Of CLW Studio----------*///start addanswer():添加备选答案个数
var count=0; //备选答案计数
function addanswer()
{var counter=["五","六","七","八","九","十"];
if (count>5)
{alert("备选答案不可以超过十个!");
return true;
}
if(blm)
mytype="<input type='checkbox' id='r"+(count+5)+"' name='rkey"+(count+5)+"' value='"+(count+5)+"'>";
else
mytype="<input type='radio' id='r"+(count+5)+"' name='rkey' value='"+(count+5)+"'>";
addnews.innerHTML+="<table width='576' height='25' border='0' cellpadding='0' cellspacing='0' class='text'><tr><td width='64'><div align='center' >备选答案"+counter[count]+"</div></td><td width='512'><input name='answer"+(count+5)+"' type='text' class='inp' style='width:350px'> <label for='r"+(count+5)+"'>"+mytype+" 正确答案</label></td></tr></table>";
document.form1.answercount.value=count+5;
count++;
}
//end addanswer()//start nofocus():消去选框点击后留下的虚线框
function nofocus()
{if(event.srcElement.type=="radio" || event.srcElement.type=="checkbox")
event.srcElement.blur();
}
document.onclick=nofocus;
//end nofocus()//start shownow():预览试题
function shownow()
{if(!checkvalue())
return false;
with(form1)
{replacestr="____";
tshow=question.value;
if(tshow.indexOf("[blank]")==-1)
tshow+="[blank]";
tshow=tshow.replace("[blank]",replacestr);
tshow=replaceall(tshow)+"<br>";
for(i=1;i<=answercount.value;i++)
{eval("ans=answer"+i);
tshow+=String.fromCharCode(64+i)+":"+ans.value+"<br>"
}
tshow+="本题正确答案是:"
for(i=1;i<=answercount.value;i++)
{eval("rk=r"+i);
if(rk.checked)
tshow+=String.fromCharCode(64+i)+" ";
}
}
nw=window.open();
nw.document.write("<body bgcolor='#D3D3A9'>");
nw.document.write(tshow);
nw.document.close();
}
//end shownow()//start replaceall():对空格及回车进行替换
function replaceall(str)
{while(str.indexOf("\n")!=-1)
str=str.replace("\n","<br>");
while(str.indexOf(" ")!=-1)
str=str.replace(" "," ");
return str;
}
//end replaceall()//start checkvalue():检查表单的合法性
function checkvalue()
{var counter=["","一","二","三","四","五","六","七","八","九","十"];
with(form1)
{if(point.value=="")
{alert("请填写本题分值!");
point.focus();
return false;
}
else
if(isNaN(point.value))
{alert("试题分值必须是数字!\n请重新填写!");
point.focus();
return false;
}
if(question.value=="")
{alert("请填写题目!");
question.focus();
return false;
}
else
{if(question.value.indexOf("[blank]")!=question.value.lastIndexOf("[blank]"))
{alert("此题型只能有一个空!\n请重新填写!");
question.focus();
return false;
}
if(question.value.indexOf("[blank]")==-1)
{if(!confirm("您没有明确的指定本题的空在什么地方!\n如果您不指定,系统将为您自动在最后加上!\n要继续吗?"))
{question.focus();
return false;
}
else
question.value+="[blank]";
}
}
for(i=1;i<=answercount.value;i++)
{eval("ans=answer"+i);
if(ans.value=="")
{alert("请填写备选答案"+counter[i]+"!");
ans.focus();
return false;
}
}
for(i=1;i<=answercount.value;i++)
{eval("rk=r"+i);
if(rk.checked)
break;
}
if(i>answercount.value)
{alert("请选择正确答案!");
return false;
}
}
return true;
}
//end checkvalue()
</script>
</head>
给你个我以前写的,看得上就自己改改!
<html>
<script language=javascript>blm=0</script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>选择题添加</title>
<style>
.text {
font-family: "宋体";
font-size: 9pt;
line-height: 150%;
}
.dshadow {
filter: DropShadow(Color=#000000, OffX=1, OffY=1);
font-family: "宋体";
font-size: 9pt;
color: #E3E3C8;
}
.allborder {
border: 1px solid #000000;
font-family: "宋体";
font-size: 9pt;}
.tbborder {
border-top: 1px solid #000000;
border-bottom: 1px solid #000000;
}
a:link {
font-family: "宋体";
font-size: 9pt;
color: #5B5C3D;
text-decoration: none;
}
a:visited {
font-family: "宋体";
font-size: 9pt;
color: #5B5C3D;
text-decoration: underline;
}
a:hover {
font-family: "宋体";
font-size: 9pt;
color: #848435;
text-decoration: underline overline;
}
body {
background-color: #d3d3a9;
font-size: 13px;}
.inp {
font-family: "宋体";
font-size: 9pt;
height:16px;
border:0px;
border-bottom: 1px solid #000000;
background-color: #D3D3A9;
}
.but {
font-family: "宋体";
font-size: 9pt;
border: 0px;
background-color: #D3D3A9;
cursor: hand;
}
label {
cursor: hand;
}
</style>
<script language="JavaScript">
/*------选择题->单空选择题出题版块使用js文件!------*/
/*----------Edit By 心云意水 Of CLW Studio----------*///start addanswer():添加备选答案个数
var count=0; //备选答案计数
function addanswer()
{var counter=["五","六","七","八","九","十"];
if (count>5)
{alert("备选答案不可以超过十个!");
return true;
}
if(blm)
mytype="<input type='checkbox' id='r"+(count+5)+"' name='rkey"+(count+5)+"' value='"+(count+5)+"'>";
else
mytype="<input type='radio' id='r"+(count+5)+"' name='rkey' value='"+(count+5)+"'>";
addnews.innerHTML+="<table width='576' height='25' border='0' cellpadding='0' cellspacing='0' class='text'><tr><td width='64'><div align='center' >备选答案"+counter[count]+"</div></td><td width='512'><input name='answer"+(count+5)+"' type='text' class='inp' style='width:350px'> <label for='r"+(count+5)+"'>"+mytype+" 正确答案</label></td></tr></table>";
document.form1.answercount.value=count+5;
count++;
}
//end addanswer()//start nofocus():消去选框点击后留下的虚线框
function nofocus()
{if(event.srcElement.type=="radio" || event.srcElement.type=="checkbox")
event.srcElement.blur();
}
document.onclick=nofocus;
//end nofocus()//start shownow():预览试题
function shownow()
{if(!checkvalue())
return false;
with(form1)
{replacestr="____";
tshow=question.value;
if(tshow.indexOf("[blank]")==-1)
tshow+="[blank]";
tshow=tshow.replace("[blank]",replacestr);
tshow=replaceall(tshow)+"<br>";
for(i=1;i<=answercount.value;i++)
{eval("ans=answer"+i);
tshow+=String.fromCharCode(64+i)+":"+ans.value+"<br>"
}
tshow+="本题正确答案是:"
for(i=1;i<=answercount.value;i++)
{eval("rk=r"+i);
if(rk.checked)
tshow+=String.fromCharCode(64+i)+" ";
}
}
nw=window.open();
nw.document.write("<body bgcolor='#D3D3A9'>");
nw.document.write(tshow);
nw.document.close();
}
//end shownow()//start replaceall():对空格及回车进行替换
function replaceall(str)
{while(str.indexOf("\n")!=-1)
str=str.replace("\n","<br>");
while(str.indexOf(" ")!=-1)
str=str.replace(" "," ");
return str;
}
//end replaceall()//start checkvalue():检查表单的合法性
function checkvalue()
{var counter=["","一","二","三","四","五","六","七","八","九","十"];
with(form1)
{if(point.value=="")
{alert("请填写本题分值!");
point.focus();
return false;
}
else
if(isNaN(point.value))
{alert("试题分值必须是数字!\n请重新填写!");
point.focus();
return false;
}
if(question.value=="")
{alert("请填写题目!");
question.focus();
return false;
}
else
{if(question.value.indexOf("[blank]")!=question.value.lastIndexOf("[blank]"))
{alert("此题型只能有一个空!\n请重新填写!");
question.focus();
return false;
}
if(question.value.indexOf("[blank]")==-1)
{if(!confirm("您没有明确的指定本题的空在什么地方!\n如果您不指定,系统将为您自动在最后加上!\n要继续吗?"))
{question.focus();
return false;
}
else
question.value+="[blank]";
}
}
for(i=1;i<=answercount.value;i++)
{eval("ans=answer"+i);
if(ans.value=="")
{alert("请填写备选答案"+counter[i]+"!");
ans.focus();
return false;
}
}
for(i=1;i<=answercount.value;i++)
{eval("rk=r"+i);
if(rk.checked)
break;
}
if(i>answercount.value)
{alert("请选择正确答案!");
return false;
}
}
return true;
}
//end checkvalue()
</script>
</head>
<form name="form1" method="post" onSubmit="return checkvalue()" action="adds1.php?which=<?=$which?>">
<table width="576" border="0" height="1" cellspacing="0" cellpadding="0">
<tr>
<td width="170" height="1" bgcolor="#999A67">
<table width="170" height="1" border="0" cellpadding="5" cellspacing="0" class="allborder">
<tr>
<td width="42" height="1" bgcolor="#D3D3A9" style="border-right:1px solid #000000;"> </td>
<td width="106" class="dshadow"> <div align="center">
<?=$tit?>
</div></td>
</tr>
</table></td>
<td width="269"> </td>
<td width="137" class="text"><div align="center"></div></td>
</tr>
</table>
<table width="576" border="0" cellpadding="5" cellspacing="0" class="text">
<tr>
<td width="54" height="28" valign="top"> </td>
<td width="524" valign="top"> 在本版块,您可以添加<?=$nr?>,并指定分值。</td>
</tr>
</table>
<table width="576" height="25" border="0" cellpadding="0" cellspacing="0" class="text">
<tr>
<td width="63"><div align="center">请选择科目</div></td>
<td width="513">
<select name="sub" class="inp" >
</select>
</td>
</tr>
</table>
<table width="576" height="25" border="0" cellpadding="0" cellspacing="0" class="text">
<tr>
<td width="63"><div align="center">请选择难度</div></td>
<td width="359">
<select name="hard" class="inp" >
<option value=1>简单</option>
<option value=2>适中</option>
<option value=3>较难</option>
</select>
</td>
<td width="154"><input type="button" value="添加备选答案" class="but" style="border: 1px solid #000000;height:17" onclick="addanswer()"><input type="hidden" name="answercount" value="4"></td>
</tr>
</table>
<table width="576" height="25" border="0" cellpadding="0" cellspacing="0" class="text">
<tr>
<td width="67"><div align="center">请填写分值</div></td>
<td width="531"> <input name="point" type="text" class="inp" style="width:30px">
分/题</td>
</tr>
</table>
<table width="576" height="25" border="0" cellpadding="0" cellspacing="0" class="text">
<tr>
<td width="64"><div align="center">做为试题</div></td>
<td width="512"> <select name="ifuse" class="inp" id="ifused">
<option value=0>是</option>
<option value=1>否</option>
</select>
</td>
</tr>
</table>
<table width="576" height="25" border="0" cellpadding="0" cellspacing="0" class="text">
<tr>
<td width="63" valign="top"> <div align="center">请填写题目</div></td>
<td width="357" valign="top"> <textarea name="question" rows="3" id="question" style="border:1px solid #000000;width:350px;height:50px;overflow-x:hidden;overflow-y:auto;background-color: #D3D3A9;"></textarea>
</td>
<td width="156" valign="top"><input name="button2" type="button" class="but" style="border: 1px solid #000000;height:17" onclick="question.value+='[blank]';question.focus()" value="填空"></td>
</tr>
</table>
<table width="576" height="25" border="0" cellpadding="0" cellspacing="0" class="text">
<tr>
<td width="64"><div align="center">备选答案一</div></td>
<td width="512"><input name="answer1" type="text" class="inp" id="answer1" style="width:350px">
<label for="r1"><input type="radio" id="r1" name="rkey" value="1">
正确答案</label> </td>
</tr>
</table>
<table width="576" height="25" border="0" cellpadding="0" cellspacing="0" class="text">
<tr>
<td width="64"><div align="center">备选答案二</div></td>
<td width="512"><input name="answer2" type="text" class="inp" id="answer2" style="width:350px">
<label for="r2">
<input type="radio" id="r2" name="rkey" value="2">
正确答案</label></td>
</tr>
</table>
<table width="576" height="25" border="0" cellpadding="0" cellspacing="0" class="text">
<tr>
<td width="64">
<div align="center">备选答案三</div></td>
<td width="512"><input name="answer3" type="text" class="inp" id="answer3" style="width:350px">
<label for="r3"><input type="radio" id="r3" name="rkey" value="3">
正确答案</label></td>
</tr>
</table>
<div id=addnews>
<table width="576" height="25" border="0" cellpadding="0" cellspacing="0" class="text">
<tr>
<td width="64">
<div align="center">备选答案四</div></td>
<td width="512"><input name="answer4" type="text" class="inp" id="answer4" style="width:350px">
<label for="r4"><input type="radio" id="r4" name="rkey" value="4">
正确答案</label></td>
</tr>
</table>
</div>
<table width="576" height="25" border="0" cellpadding="0" cellspacing="0" class="text">
<tr>
<td>
<input name="Submit" type="submit" class="but" value="添加此题……" style="border: 1px solid #000000;height:17">
<input name="button" type="button" class="but" style="border: 1px solid #000000;height:17" onclick="shownow()" value="预 览">
</td>
</tr>
</table>
</form>
</body>
</html>
<HEAD>
<TITLE>welcome</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<style>input.input01{width: 80px}</style>
<script language="javascript">
function cc(e)
{
if(e.value!='')
{
if(parseFloat(e.value)>100 || parseFloat(e.value)<1)
{
alert('你输入的数值不在1-100之间');
e.focus();
}
}
}
function setcount()
{
var str = "";
var n = document.myform.addcount.value;
if (n == "")
n = "1";
var mm = document.all.addid.rows.length;
for(i=1; i<=parseInt(n, 10); i++)
{
str += "<tr>\r\n";
str += " <td width=25% align='center' height='20'><font color='#ffffff' size='2'>增加"+ (mm+i) +"</font></td>\r\n";
str += " <td width=25% align='center' height='20'><input type='text' name='name"+ (mm+i) +"' class='input01' value=''></td>\r\n";
str += " <td width=25% align='center' height='20'><input type='text' name='pass"+ (mm+i) +"' class='input01' value=''></td>\r\n";
str += " <td width=25% align='center' height='20'><input type='text' name='class"+ (mm+i) +"' class='input01' value=''></td>\r\n";
str += "</tr>\r\n"
}
alert(str)
var tableOutStr = document.all.addid.outerHTML;
var tableInStr = document.all.addid.innerHTML;
var a = tableOutStr.split(tableInStr);
document.all.addid.outerHTML = a[0] + tableInStr + str + a[1];
}
</script>
</HEAD><BODY>
<form action="test.asp" method="post" name="myform">
<table width="500" border="1" cellspacing="0" cellpadding="0" bordercolor="#33CCFF" bgcolor="#006699">
<tr>
<td colspan="4" align="center" height="20"><font color="#ffffff" size="2">管理员表字典维护</font></td>
</tr>
<tr>
<td align="center" height="20"><font color="#ffffff" size="2">设定增加个数:</font>
</td>
<td colspan="2" align="center" height="20"><input type="text" name="addcount" value="1" class="input01"
onkeypress="var k=event.keyCode; return k>=48&&k<=57||k==46"
onpaste="return !clipboardData.getData('text').match(/\D/)"
onblur="cc(this)"
ondragenter="return false"
style="ime-mode:Disabled"
></td>
<td align="center">
<input type="button" name="button" onclick="setcount();" value="设 定" class="input02"></td>
</tr>
<tr>
<td width=25% align="center" height="20"><font color="#ffffff" size="2">增加</font></td>
<td width=25% align="center" height="20"><font color="#ffffff" size="2">管理员名称</font></td>
<td width=25% align="center" height="20"><font color="#ffffff" size="2">管理员密码</font></td>
<td width=25% align="center" height="20"><font color="#ffffff" size="2">管理员级别</font></td>
</tr> <tr>
<td colspan=4>
<table border=0 cellpadding=0 cellspacing=0 width=100% id="addid">
<tr>
<td width=25% align="center" height="20"><font color="#ffffff" size="2">增加1</font></td>
<td width=25% align="center" height="20"><input type="text" name="name1" class="input01" value=""></td>
<td width=25% align="center" height="20"><input type="text" name="pass1" class="input01" value=""></td>
<td width=25% align="center" height="20"><input type="text" name="class1" class="input01" value=""></td>
</tr></table>
</td>
</tr> <tr>
<td align="center" colspan="2"><input type="submit" name="submit" value="确 定" class="input02"></td>
<td align="center" colspan="2"><input type="reset" name="reset" value="重 置" class="input02"></td>
</tr>
</table>
</form>
</BODY>
</HTML>