<html>
<head>
<LINK
href="../css/css2.css" type=text/css rel=stylesheet>
<TITLE>添加人员</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<script>
var po_ca_show = new Array();
var po_ca_value = new Array();
var po_detail_show = new Array();
var po_detail_value = new Array();
var funtype1;po_ca_show[0]='计算机/互联网/通讯';
po_ca_value[0]='0100';
po_detail_show[0]=new Array();
po_detail_value[0]=new Array();</script><script Language="JavaScript">var psid="";function DoLoad(form,funtypev){
var n;
var i,j,k;
var num;
num= GetObjID('funtype[]');
num1= GetObjID('funtypeca'); if (!funtypev)
return;
k=0;
for (i=0;i<po_ca_show.length;i++) {
for(j = 0; j < po_detail_value[i].length; j++){
if(funtypev.indexOf(po_detail_value[i][j])!=-1) {
NewOptionName = new Option(po_detail_show[i][j], po_detail_value[i][j]);
form.elements[num].options[k] = NewOptionName;
k++;
}
}
}
}function Do_po_Change(form){
var num,n, i, m;
num= GetObjID('d_position1');
m = document.powersearch.elements[num].selectedIndex-1;
n = document.powersearch.elements[num + 1].length;
for(i = n - 1; i >= 0; i--)
document.powersearch.elements[num + 1].options[i] = null; if (m>=0) {
for(i = 0; i < po_detail_show[m].length; i++){
NewOptionName = new Option(po_detail_show[m][i], po_detail_value[m][i]);
document.powersearch.elements[num + 1].options[i] = NewOptionName;
}
document.powersearch.elements[num + 1].options[0].selected = true;
}
}function InsertItem(ObjID, Location)
{
len=document.powersearch.elements[ObjID].length;
for (counter=len; counter>Location; counter--)
{
Value = document.powersearch.elements[ObjID].options[counter-1].value;
Text2Insert = document.powersearch.elements[ObjID].options[counter-1].text;
document.powersearch.elements[ObjID].options[counter] = new Option(trimPrefixIndent(Text2Insert), Value);
}
}
function GetLocation(ObjID, Value)
{
total=document.powersearch.elements[ObjID].length;
for (pp=0; pp<total; pp++)
if (document.powersearch.elements[ObjID].options[pp].text == "---"+Value+"---")
{ return (pp);
break;
}
return (-1);
}
{
for (var ObjID=0; ObjID < window.powersearch.elements.length; ObjID++)
if ( window.powersearch.elements[ObjID].name == ObjName )
{ return(ObjID);
break;
}
return(-1);
}
function ToSubmit()
{ SelectTotal('jobarea[]');}
function SelectTotal(ObjName)
{
ObjID = GetObjID(ObjName);
if (ObjID != -1)
{ for (i=0; i<document.powersearch.elements[ObjID].length; i++)
document.powersearch.elements[ObjID].options[i].selected = true;
}
}
function AddItem(ObjName, DesName, CatName)
{
//GET OBJECT ID AND DESTINATION OBJECT
ObjID = GetObjID(ObjName);
DesObjID = GetObjID(DesName);
// window.alert(document.powersearch.elements[DesObjID].length);
k=0;
i = document.powersearch.elements[ObjID].options.length;
if (i==0)
return;
maxselected=0
for (h=0; h<i; h++)
if (document.powersearch.elements[ObjID].options[h].selected ) {
k=k+1;
maxselected=h+1;
}
if (maxselected>=i)
maxselected=0;
if ( document.powersearch.elements[DesObjID].length + k >1000 ) {
window.alert("最多可选择1000条");
return;
} if (CatName != "")
CatObjID = GetObjID(CatName);
else
CatObjID = 0;
if ( ObjID != -1 && DesObjID != -1 && CatObjID != -1 )
{ jj = document.powersearch.elements[CatObjID].selectedIndex;
if ( CatName != "")
{ CatValue = document.powersearch.elements[CatObjID].options[jj].text;
CatCode = document.powersearch.elements[CatObjID].options[jj].value;
}
else
CatValue = "";
i = document.powersearch.elements[ObjID].options.length;
j = document.powersearch.elements[DesObjID].options.length;
for (h=0; h<i; h++)
{ if (document.powersearch.elements[ObjID].options[h].selected )
{ Code = document.powersearch.elements[ObjID].options[h].value;
Text = document.powersearch.elements[ObjID].options[h].text;
j = document.powersearch.elements[DesObjID].options.length;
if (Text.indexOf('--不限--')!=-1) {
for (k=j-1; k>=0; k-- ) {
document.powersearch.elements[DesObjID].options[k]=null;
}
j=0;
}
if (Text.substring(0,1)=='-' && Text.substring(1,2)!='-') {
for (k=j-1; k>=0; k-- ) {
if (((document.powersearch.elements[DesObjID].options[k].value).substring(0,2))==(Code.substring(0,2)))
document.powersearch.elements[DesObjID].options[k]=null;
}
j= document.powersearch.elements[DesObjID].options.length;
}
HasSelected = false;
for (k=0; k<j; k++ ) {
if ((document.powersearch.elements[DesObjID].options[k].text).indexOf('--不限--')!=-1){
HasSelected = true;
window.alert('已经包括本选项:'+Text);
break;
}
//else if ((document.powersearch.elements[DesObjID].options[k].text).indexOf('-')!=-1
else if ((document.powersearch.elements[DesObjID].options[k].text).substring(0,1) == '-'
&& ((document.powersearch.elements[DesObjID].options[k].value).substring(0,2)==Code.substring(0,2))){
HasSelected = true;
window.alert('已经包括本选项:'+Text);
break;
}
if (document.powersearch.elements[DesObjID].options[k].value == Code)
{ HasSelected = true;
break;
}
}
if ( HasSelected == false)
{
Text = trimPrefixIndent(Text);
if (CatValue !="")
{
Location = GetLocation(DesObjID, CatValue);
if ( Location == -1 )
{
document.powersearch.elements[DesObjID].options[j] = new Option("---"+CatValue+"---",CatCode);
document.powersearch.elements[DesObjID].options[j+1] = new Option(Text, Code);
}//if
else
{
InsertItem(DesObjID, Location+1);
document.powersearch.elements[DesObjID].options[Location+1] = new Option(Text, Code);
}//else
}
else
{
document.powersearch.elements[DesObjID].options[j] = new Option(Text, Code);
}
}//if
document.powersearch.elements[ObjID].options[h].selected =false;
}//if
}//for
document.powersearch.elements[ObjID].options[maxselected].selected =true;
}//if
}//end of functionfunction DeleteItem(ObjName)
{
ObjID = GetObjID(ObjName);
minselected=0;
if ( ObjID != -1 )
{
for (i=window.powersearch.elements[ObjID].length-1; i>=0; i--)
{ if (window.powersearch.elements[ObjID].options[i].selected)
{ // window.alert(i);
if (minselected==0 || i<minselected)
minselected=i;
window.powersearch.elements[ObjID].options[i] = null;
}
}
i=window.powersearch.elements[ObjID].length; if (i>0) {
if (minselected>=i)
minselected=i-1;
window.powersearch.elements[ObjID].options[minselected].selected=true;
}
}
}function CheckMultiSelect()
{
areaID = GetObjID('jobarea[]');
i1=window.powersearch.elements[areaID].length;
if (i1==0 ) {
window.alert('按添加按扭增加选项');
return false;
} i=0;
if (i1>0 && window.powersearch.elements[areaID][0].value=='0000')
i++;
return true;
}function save(){
if (!CheckMultiSelect()) return;
ToSubmit();
document.powersearch.target='_top';
document.powersearch.action='/sc/my_se.php?save=save';
document.powersearch.submit();
}
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#FFFFFF">
<script language="JavaScript">
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
</script>
<TABLE width="80%" border="0" cellspacing="0" cellpadding="0" align="center">
<TR>
</table>
<form name='powersearch' action='/sc/my_se.php' method='post' class=formfix><input type=hidden name='create' value=''><input type=hidden name='oldsearchname' value=''><input type=hidden name=scchannel value=my><center>
<table>
<tr><td align=left bgcolor=#eff1f3 height=20> </td></tr>
<script language="javascript">
function trimPrefix(str,prefix)
{
var tmpstr = str;
var len = prefix.length;
//alert("char code:"+tmpstr.charCodeAt(0));
//alert(tmpstr.substring(0,len));
if(tmpstr.substring(0,len) == prefix)
//if(prefix.indexOf(tmpstr.substring(0,len)) != -1)
{
tmpstr = tmpstr.substr(len);
}
return tmpstr;
}function trimPrefixIndent(str)
{
//(2004-01-18,by Fred)space in Option.text is unicode 160
var prefixIndent = String.fromCharCode(160,160)+"--";
return trimPrefix(str,prefixIndent);
}
</script><table border=0 align=center cellSpacing=0 cellpadding=3 width=80%>
<tr> <TD align=right valign=top width=80></TD>
<td width=420 align=center colspan=3>
<table width=100% cellpadding=0 cellspacing=0><tr>
<TD width=40% height="168">
<select name="Areaca" size="10" multiple>
<option value="11">1</option>
<option value="22">2</option>
<option value="33">3</option>
<option value="44">4</option>
<option value="55">5</option>
<option value="66">6</option>
<option value="77">7</option>
<option value="88">8</option>
</select></td> <TD ALIGN="CENTER" width=25%>
<INPUT TYPE="BUTTON" NAME="" VALUE="添加>>" OnClick="JavaScript:AddItem('Areaca','jobarea[]', '')">
<BR>
<INPUT TYPE="BUTTON" NAME="" VALUE="<<删除" OnClick="JavaScript:DeleteItem('jobarea[]')">
</TD>
<TD width=35%>
<select name="jobarea[]" size=4 MULTIPLE style="width: 120; height: 167">
</select>
</TD>
</tr></table>
<table width="90%" border="0" align="center">
<tr>
<td><div align="center">
<input type="submit" name="Submit" value="确定">
</div></td>
</tr>
</table>
</td>
</tr><tr>
<TD align=right valign=top width=80></TD>
<TD width=420 align=center colspan=3></tr></table><br><br><br> </form>
</body>
<?php
print_r($_POST);
?>
的确是提交不了!什么原因呢?
原来右边的列表没有选中项,请在提交事件中设置他们全被选中即可这个代码也太臭了,至多一半的代码就可以了