回 帖 发 新 帖 刷新版面

主题:这个搜索功能,怎么替换,请高手帮看看这段程序?

要做一个房子的搜索功能,但城市太多,而且要对应城市,这怎么弄,部分程序如下:
  <FORM name=frmRegionSearch action="search_sell.asp" method=post target=_blank onSubmit="return checksearch()">   
    <tr>
      <td ><div align="center">买卖</div></td>
       <TD><SELECT style="WIDTH: 60px" onChange="cityChange(frmRegionSearch,'城市');" name=city><OPTION value=城市 selected>城市</OPTION></SELECT> </TD>
       <TD><SELECT style="WIDTH: 60px" name=district> <OPTION value="" selected>行政区</OPTION></SELECT> </TD>
      <TD><SELECT style="WIDTH: 60px" onchange=regionSearchChange(document.frmRegionSearch); name=housetype> <OPTION value=normal selected>住宅类</OPTION> <OPTION value=busi>商用类</OPTION> <OPTION value=plaza>写字楼</OPTION></SELECT> </TD>
      <TD><SELECT style="WIDTH: 60px" name=price><OPTION value="" selected>价格</OPTION></SELECT> </TD>
      <TD><SELECT style="WIDTH: 60px" name=area><OPTION value="" selected>面积</OPTION></SELECT> </TD>
      <TD><INPUT name=key style="WIDTH: 60px" value="关键字"></TD>
<td><INPUT onclick=submitRegionForm(frmRegionSearch); type=button value=查询 name=cmdSearch></td>
    </tr>
    </FORM> 
    
    
    这里边有name=city,name=district,name=housetype,name=price,name=area,我想把他替换成name=search_city,name=search_qu,name=search_lx,name=search_jg,name=search_mj
这样才行,但当调用<SCRIPT language=javascript src="jsq/district.js"></SCRIPT>
这里边的,就不知道怎么弄了,district.js 内容如下

回复列表 (共5个回复)

沙发

function districtStruct(cityid, city, districtid, district)
{    
    this.cityid = cityid;
    this.city = city;
    this.districtid = districtid;
    this.district = district;
}

function optionStruct(optionValue, optionText)
{    
    this.optionValue = optionValue;
    this.optionText = optionText;    
}

var arrCity = new Array();
var nCityIndex = 0;
var arrCityDistrict = new Array();
var nIndex = 0;
var arrSalePrice = new Array();
var arrSalePriceBusi = new Array();
var arrSalePricePlaza = new Array();
var arrRentPrice = new Array();
var arrRentPriceBusi = new Array();
var arrRentPricePlaza = new Array();
var arrArea = new Array();

arrCity[nCityIndex++] = "北京";
arrCity[nCityIndex++] = "厦门";
arrCity[nCityIndex++] = "郑州";
arrCity[nCityIndex++] = "温州";
arrCity[nCityIndex++] = "上海";
arrCity[nCityIndex++] = "广州";
arrCity[nCityIndex++] = "深圳";
arrCity[nCityIndex++] = "大连";
arrCity[nCityIndex++] = "宁波";
arrCity[nCityIndex++] = "杭州";
arrCity[nCityIndex++] = "青岛";
arrCity[nCityIndex++] = "天津";
arrCity[nCityIndex++] = "成都";
arrCity[nCityIndex++] = "福州";
arrCity[nCityIndex++] = "武汉";
arrCity[nCityIndex++] = "苏州";
arrCity[nCityIndex++] = "南京";
arrCity[nCityIndex++] = "长沙";
arrCity[nCityIndex++] = "济南";
arrCity[nCityIndex++] = "西安";
arrCity[nCityIndex++] = "石家庄";
arrCity[nCityIndex++] = "昆明";
arrCity[nCityIndex++] = "沈阳";
arrCity[nCityIndex++] = "潍坊";

arrCityDistrict[nIndex++] = new districtStruct(1, "北京", 0, "朝阳区"); 
arrCityDistrict[nIndex++] = new districtStruct(1, "北京", 1, "东城区"); 
arrCityDistrict[nIndex++] = new districtStruct(1, "北京", 2, "西城区"); 
arrCityDistrict[nIndex++] = new districtStruct(1, "北京", 3, "海淀区"); 
arrCityDistrict[nIndex++] = new districtStruct(1, "北京", 4, "丰台区"); 
arrCityDistrict[nIndex++] = new districtStruct(1, "北京", 5, "石景山区"); 
arrCityDistrict[nIndex++] = new districtStruct(1, "北京", 6, "崇文区"); 
arrCityDistrict[nIndex++] = new districtStruct(1, "北京", 7, "宣武区"); 
arrCityDistrict[nIndex++] = new districtStruct(1, "北京", 8, "通州区"); 
arrCityDistrict[nIndex++] = new districtStruct(1, "北京", 9, "房山区"); 
arrCityDistrict[nIndex++] = new districtStruct(1, "北京", 10, "大兴区"); 
arrCityDistrict[nIndex++] = new districtStruct(1, "北京", 11, "门头沟区"); 
arrCityDistrict[nIndex++] = new districtStruct(1, "北京", 12, "延庆县"); 
arrCityDistrict[nIndex++] = new districtStruct(1, "北京", 13, "密云县"); 
arrCityDistrict[nIndex++] = new districtStruct(1, "北京", 14, "怀柔区"); 
arrCityDistrict[nIndex++] = new districtStruct(1, "北京", 15, "平谷区"); 
arrCityDistrict[nIndex++] = new districtStruct(1, "北京", 16, "顺义区"); 
arrCityDistrict[nIndex++] = new districtStruct(1, "北京", 17, "昌平区"); 
arrCityDistrict[nIndex++] = new districtStruct(1, "北京", 18, "其它地区"); 
arrCityDistrict[nIndex++] = new districtStruct(2, "厦门", 0, "厦门开元区"); 
arrCityDistrict[nIndex++] = new districtStruct(2, "厦门", 1, "厦门思明区"); 
arrCityDistrict[nIndex++] = new districtStruct(2, "厦门", 2, "厦门湖里区"); 
arrCityDistrict[nIndex++] = new districtStruct(2, "厦门", 3, "厦门鼓浪屿区"); 
arrCityDistrict[nIndex++] = new districtStruct(2, "厦门", 4, "厦门集美区"); 
arrCityDistrict[nIndex++] = new districtStruct(2, "厦门", 5, "厦门杏林区"); 
arrCityDistrict[nIndex++] = new districtStruct(2, "厦门", 6, "厦门同安区"); 
arrCityDistrict[nIndex++] = new districtStruct(2, "厦门", 7, "厦门海沧区"); 
arrCityDistrict[nIndex++] = new districtStruct(2, "厦门", 8, "泉州丰泽区"); 
arrCityDistrict[nIndex++] = new districtStruct(2, "厦门", 9, "泉州洛江区"); 
arrCityDistrict[nIndex++] = new districtStruct(2, "厦门", 10, "泉州鲤城区"); 
arrCityDistrict[nIndex++] = new districtStruct(2, "厦门", 11, "泉州泉港区"); 
arrCityDistrict[nIndex++] = new districtStruct(2, "厦门", 12, "厦门翔安区"); 
arrCityDistrict[nIndex++] = new districtStruct(2, "厦门", 13, "泉州石狮区"); 
arrCityDistrict[nIndex++] = new districtStruct(2, "厦门", 14, "泉州晋江区"); 
arrCityDistrict[nIndex++] = new districtStruct(3, "郑州", 0, "金水区"); 
arrCityDistrict[nIndex++] = new districtStruct(3, "郑州", 1, "中原区"); 
arrCityDistrict[nIndex++] = new districtStruct(3, "郑州", 2, "二七区"); 
arrCityDistrict[nIndex++] = new districtStruct(3, "郑州", 3, "管城区"); 

板凳

name=city,name=district,name=housetype,name=price,name=area,我想把他替换成name=search_city,name=search_qu,name=search_lx,name=search_jg,name=search_mj
,这里边能不能用函数写,做个替换,但不知道怎么写,请高手帮看看

3 楼

str="name=……"
str=replace("name=city","name=search_city")
str=replace("name=district","name=search_qx")
以此类推
最后得到你想要的

4 楼

刚试过好象不行,是不是我写错地方了,你能写具体点,这str=replace应该用什么格式去写,是不是放在脚本里,在什么地方写呢,我是菜鸟,大侠有时间帮看看,指点指点

5 楼

<%
str="name=……"
replace(str,"name=city","name=search_city")
replace(str,"name=district","name=search_qx")
....
%>

我来回复

您尚未登录,请登录后再回复。点此登录或注册