我以前做的,应该可以进精华区的-->记录多选框的选择次序
来源:岁月联盟
时间:2003-07-11
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width='100%' height='4%' border='0' cellspacing='1' cellpadding='2' bordercolorlight='#000000' bordercolordark='#333333' align="center">
<tr bgcolor="#CCCCCC">
<td width="9%" height="7" >
<div align="center">选择</div>
</td>
</tr>
<FORM METHOD=POST ACTION="" name="post">
<tr bgcolor="#CCCCCC">
<td width="9%" height="12" >
<input type="checkbox" value="1" onClick="putvalueto(this,'1')" name="checkbox">
<input type="checkbox" value="2" onClick="putvalueto(this,'2')" name="checkbox">
<input type="checkbox" value="3" onClick="putvalueto(this,'3')" name="checkbox">
<input type="checkbox" value="4" onClick="putvalueto(this,'4')" name="checkbox">
<input type="hidden" name="FormSel" value="">
</td>
</tr>
</table></form>
</body>
</html>
<script>
function putvalueto(y,x){
var impitemid='';
var ob_form1=document.post
var ob_out=ob_form1.FormSel
var str_out="" + ob_out.value
if (y.checked){
impitemid=x
}
else {
var str1=""+x
var i_star=str_out.indexOf(x)
str_out=str_out.substr(0,(i_star-1))+str_out.substr((i_star+1))
if (str_out.substr(0,1)==",")
{str_out=str_out.substr(1)}
if (str_out.substr((str_out.length-1))==",")
{str_out=str_out.substr(0,str_out.length-1)}
if (str_out.indexOf(",,")>0)
{var i1=str_out.indexOf(",,")
str_out=str_out.substr(0,i1-1)+str_out.substr(i1+1)
}
impitemid==''
}
if (!impitemid=='') {
if (str_out=='') {
str_out=impitemid
}
else {
str_out=str_out+','+impitemid
}
}
ob_out.value=str_out
alert (ob_form1.FormSel.value);
}
</script>
上一篇:放大镜