这是我程序的原来码,请各位大侠帮我看一下应该咋改!
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html;
charset=gb2312">
<title>新建网页 1</title>
<SCRIPT language=JavaScript>
function save_search()
{
if (document.Form1.name.value == "")
{
alert("请输入搜索器的名字,建议每个搜索器不要重名!!!");
return false;
}
else
{ ToGo();
document.Form1.action = "mysave.asp";
document.Form1.submit();
return true;
}
}
</SCRIPT>
<SCRIPT language=JavaScript>
function ToGo()
{
SelectTotal('city');
SelectTotal('position_type');
SelectTotal('company_type');
//window.Form1.action="ti1.asp";
//window.Form1.submit();
}
function SelectTotal(ObjName)
{ ObjID = GetObjID(ObjName);
if (ObjID != -1)
{ for (i=0;
i<document.Form1.elements[ObjID].length;
i++)
do
cument.Form1.elements[ObjID].options.selected = true;
}
}
function GetObjID(ObjName)
{ for ( var ObjID=0;
ObjID < window.Form1.elements.length;
ObjID++ )
if (window.Form1.elements[ObjID].name == ObjName )
{ return(ObjID);
break;
}
return(-1);
}
function IsSelected(ID, Value)
{ if (ID != -1 &&
Value != "")
{ for (var cc=0;
cc<document.Form1.elements[ID].length;
cc++ )
{ if (document.Form1.elements[ID].options[cc].value == Value)
return true;
}
return false;
}
return false;
}
function HasTotal(ID)
{ if (ID != -1 )
{ for (var cc=0;
cc<document.Form1.elements[ID].length;
cc++ )
{ if (do
cument.Form1.elements[ID].options[cc].selected )
{ if (document.Form1.elements[ID].options[cc].value == "0000")
{ return true;
}
}
}
return false;
}
return false;
}
function AppendItem(ObjName, DesName)
{ ObjID = GetObjID(ObjName);
DesObjID = GetObjID(DesName);
if (ObjID != -1 &&
DesObjID != -1)
{ if ( IsSelected(DesObjID, "0000") )
window.alert("已包含");
else
{ if ( HasTotal(ObjID) )
{ do
cument.Form1.elements[DesObjID].length = 0;
do
cument.Form1.elements[DesObjID].options[0]= new Option("---不限---", "0000");
}
else
{ if (document.Form1.elements[DesObjID].length == 5)
window.alert("最多选五项。");
else
{ //GET SELECTED ITEM NUMBER
SelNum = 0;
for (var j=0;
j<document.Form1.elements[ObjID].length;
j++)
{ if (do
cument.Form1.elements[ObjID].options[j].selected)
SelNum ++;
}
if ((SelNum +do
cument.Form1.elements[DesObjID].length) > 5)
window.alert("最多选五项。");
else
{ //add
for (j=0;
j<document.Form1.elements[ObjID].length;
j++)
{ if (document.Form1.elements[ObjID].options[j].selected)
{ //GET VALUE
dd =do
cument.Form1.elements[ObjID].options[j].value;
if (!IsSelected(DesObjID, dd))
{ //GET LENGTH
DesLen =do
cument.Form1.elements[DesObjID].length;
// NEW OPTION
do
cument.Form1.elements[DesObjID].options[DesLen]= new Option(document.Form1.elements[ObjID].options[j].text,do
cument.Form1.elements[ObjID].options[j].value);
}
else
window.alert("此选项已选择。");
}
}
}
}
}
}
//CLEAR
for (j=0;
j<document.Form1.elements[ObjID].length;
j++)
do
cument.Form1.elements[ObjID].options[j].selected = false;
}
}
function RemoveItem(ObjName)
{ ObjID = GetObjID(ObjName);
if ( ObjID != -1 )
{ var check_index = new Array();
for (i=window.Form1.elements[ObjID].length-1;
i>=0;
i--)
{ if (window.Form1.elements[ObjID].options.selected)
{ check_index = true;
window.Form1.elements[ObjID].options.selected = false;
}
else
check_index = false;
}
for (i=window.Form1.elements[ObjID].length-1;
i>=0;
i--)
{ if (check_index)
window.Form1.elements[ObjID].options = null
}
}
}
</SCRIPT>
</head>
<body>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=600>
<TR>
<form method="POST" name="Form1">
<TD align=right vAlign=top><FONT color=#ff3333>*</FONT>工作地点:
<SCRIPT language=javascript>
<!--
function initprovince()
{
province = new Array();
province[0] = new Array();
province[0][0] ='*';
province[0][1] ='--请选择--';
province[1] = new Array();
province[1][0] ='北京';
province[1][1] ='北京';
province[2] = new Array();
province[2][0] ='上海';
province[2][1] ='上海';
province[3] = new Array();
province[3][0] ='天津';
province[3][1] ='天津';
province[4] = new Array();
province[4][0] ='重庆';
province[4][1] ='重庆';
province[5] = new Array();
province[5][0] ='安徽';
province[5][1] ='安徽';
province[6] = new Array();
province[6][0] ='甘肃';
province[6][1] ='甘肃';
province[7] = new Array();
province[7][0] ='福建';
province[7][1] ='福建';
province[8] = new Array();
province[8][0] ='广东';
province[8][1] ='广东';
province[9] = new Array();
province[9][0] ='广西';
province[9][1] ='广西';
province[10] = new Array();
province[10][0] ='贵州';
province[10][1] ='贵州';
province[11] = new Array();
province[11][0] ='海南';
province[11][1] ='海南';
province[12] = new Array();
province[12][0] ='河北';
province[12][1] ='河北';
province[13] = new Array();
province[13][0] ='河南';
province[13][1] ='河南';
province[14] = new Array();
province[14][0] ='黑龙江';
province[14][1] ='黑龙江';
province[15] = new Array();
province[15][0] ='湖北';
province[15][1] ='湖北';
province[16] = new Array();
province[16][0] ='湖南';
province[16][1] ='湖南';
province[17] = new Array();
province[17][0] ='吉林';
province[17][1] ='吉林';
province[18] = new Array();
province[18][0] ='江苏';
province[18][1] ='江苏';
province[19] = new Array();
province[19][0] ='江西';
province[19][1] ='江西';
province[20] = new Array();
province[20][0] ='辽宁';
province[20][1] ='辽宁';
province[21] = new Array();
province[21][0] ='内蒙古';
province[21][1] ='内蒙古';
province[22] = new Array();
province[22][0] ='宁夏';
province[22][1] ='宁夏';
province[23] = new Array();
province[23][0] ='青海';
province[23][1] ='青海';
province[24] = new Array();
province[24][0] ='山东';
province[24][1] ='山东';
province[25] = new Array();
province[25][0] ='山西';
province[25][1] ='山西';
province[26] = new Array();
province[26][0] ='陕西';
province[26][1] ='陕西';
province[27] = new Array();
province[27][0] ='四川';
province[27][1] ='四川';
province[28] = new Array();
province[28][0] ='西藏';
province[28][1] ='西藏';
province[29] = new Array();
province[29][0] ='新疆';
province[29][1] ='新疆';
province[30] = new Array();
province[30][0] ='云南';
province[30][1] ='云南';
province[31] = new Array();
province[31][0] ='浙江';
province[31][1] ='浙江';
province[32] = new Array();
province[32][0] ='香港特别行政区';
province[32][1] ='香港特别行政区';
province[33] = new Array();
province[33][0] ='澳门特别行政区';
province[33][1] ='澳门特别行政区';
province[34] = new Array();
province[34][0] ='台湾';
province[34][1] ='台湾';
}
function initprovinceitem(myfrm,selected)
{
var i
for(i = 0;
i<=province.length-1;
i++)
{
if (province[0] == selected )
document.write('<option value=' + province[0] + ' selected>' + province[1] + '</option>/n');
else
document.write('<option value=' + province[0] + '>' + province[1] + '</option>/n');
}
}
//-->
</SCRIPT>
<SCRIPT language=javascript>
<!--
initprovince();
//-->
</SCRIPT>
</TD>
<TD align=middle><SELECT multiple name=city2 size=5
style="WIDTH: 150px">
<SCRIPT language=javascript>
<!--
initprovinceitem(document.form1,'');
//-->
</SCRIPT>
</SELECT> </TD>
<TD align=middle><INPUT name=Input onclick="JavaScript:AppendItem('city2','city')" type=button value="添加>>">
<BR><BR><INPUT name=Input2 onclick="JavaScript:RemoveItem('city')" type=button value="<<删除">
</TD>
<TD align=middle><SELECT multiple name=city size=5
style="WIDTH: 150px"></SELECT> </TD>
<TD> </TD>
</form>
</TR>
</TABLE>
</body>
</html>
我最后要抓的是city框