Heim >Backend-Entwicklung >PHP-Tutorial > 用JS做了个省市县三级联动效果可存入数据库的值老不对,有代码

用JS做了个省市县三级联动效果可存入数据库的值老不对,有代码

WBOY
WBOYOriginal
2016-06-13 12:56:35833Durchsuche

用JS做了个省市县三级联动效果可存入数据库的值老不对,有代码,在线等
现在的问题是这样的,当我选好地址后就提交他到数据库中去,可是现在怎么修改提交到数据库中的值都是前面的那些编码,就不是后面的文字。要怎么修改才能正确提交后面的文字呢,望知道的达人,能为小弟排忧解难.........


一下是选择框的代码:

<tr><br />
      <td width="301" height="31"  align="right"></td><br />
      <td height="31" colspan="2" align="left">上级产地编码:</td><br />
      <td width="549">省:<br />
      <select name="jpr" id="jpr"><option>请选择</option></select>市:<select name="jci" id="ici"><option>请选择</option></select>县(区):<select<br />
name="jco" id="jco"><option>请选择</option></select><script language="javascript" defer="defer">new PCAS<br />
("jpr","jci","jco","","","");</script></td><br />
    </tr>

一下是JS代码:

var city_data="";<br>
city_data="010000|请选择,110000|北京市,110100|市辖区,110101|东城区,110102|西城区,110103|崇文区,110104|宣武区,110105|朝阳区,110106|丰台区,110107|石景山区,110108|海淀区,110109|门头沟区,110111|房山区,110112|通州区,110113|顺义区,110114|昌平区,110115|大兴区,110116|怀柔区,110117|平谷区,110200|县,110228|密云县,110229|延庆县,120000|天津市,120100|市辖区,120101|和平区,120102|河东区,120103|河西区,120104|南开区,120105|河北区,120106|红桥区,120107|塘沽区,120108|汉沽区,120109|大港区,120110|东丽区,120111|西青区,120112|津南区,120113|北辰区,120114|武清区,120115|宝坻区,120200|县,120221|宁河县,120223|静海县,120225|蓟县,130000|河北省,130100|石家庄市,130101|市辖区,130102|长安区,130103|桥东区,130104|桥西区,130105|新华区,130107|井陉矿区,130108|裕华区,130121|井陉县,130123|正定县,130124|栾城县,130125|行唐县,130126|灵寿县,130127|高邑县,130128|深泽县,130129|赞皇县,130130|无极县,130131|平山县,130132|元氏县,130133|赵县,130181|辛集市,130182|藁城市,130183|晋州市,130184|新乐市,130185|鹿泉市,130200|唐山市,130201|市辖区,130202|路南区,130203|路北区,130204|古冶区,130205|开平区,130207|丰南区,130208|丰润区,130223|滦县,130224|滦南县,130225|乐亭县,130227|迁西县,130229|玉田县,130230|唐海县,130281|遵化市,130283|迁安市,130300|秦皇岛市,130301|市辖区,130302|海港区,130303|山海关区,130304|北戴河区,130321|青龙满族自治县,130322|昌黎县,130323|抚宁县,130324|卢龙县,130400|邯郸市,130401|市辖区,130402|邯山区,130403|丛台区,130404|复兴区................等等中间的省略 PCAN = city_data.split(",");<br>
        <br>
        <br>
        <br>
        function PCAS() {<br>
            this.SelP = document.getElementsByName(arguments[0])[0];<br>
            this.SelC = document.getElementsByName(arguments[1])[0];<br>
            this.SelA = document.getElementsByName(arguments[2])[0];<br>
            this.DefP = this.SelA ? arguments[3] : arguments[2];<br>
            this.DefC = this.SelA ? arguments[4] : arguments[3];<br>
            this.DefA = this.SelA ? arguments[5] : arguments[4];<br>
            this.SelP.PCA = this;<br>
            this.SelC.PCA = this;<br>
            this.SelP.onchange = function() { PCAS.SetC(this.PCA) };<br>
            if (this.SelA) this.SelC.onchange = function() { PCAS.SetA(this.PCA) };<br>
            PCAS.SetP(this) <div class="clear">
                 
              
              
        
            </div>
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn