日期:2014-05-18 浏览次数:20789 次
<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" CodeFile="Default6.aspx.cs" Inherits="Default6" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!--更新日期2010-6-7--> <html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server"> <title>AjaxTest </title> </head> <body> <form id="form1" runat="server"> <td width=130px>始发地<select id="s1" name = "nm1" runat = server style="width:178px;" onchange = "getAddrs()"></select> <select id="s2" runat = server name = "nm2" style="width:178px;" onchange = "getAddrs()"></select> <select id="s3" runat = server name = "nm3" style="width:178px;" onchange = "getAddrs()"></select></td> <td width=130px align=right>目的地</td><br /> <td width=130px><select id="sn1" name = "nm4" runat = server style="width:178px;" onchange = "getAddrs()"></select> <select id="sn2" name = "nm5" runat = server style="width:178px;" onchange = "getAddrs()"></select> <select id="sn3" name = "nm6" runat = server style="width:178px;" onchange = "getAddrs()"></select></td> </form> </body> <script language="javascript" type="text/javascript"> function LianDong(arr, sel) { this.GetCnNameByValue = function(val) { for ( var j = 0; j < arr.length; j++) { if (arr[j][0] == val) { return arr[j][2]; } } return ""; } this.GetValueByCnName = function(val) { for ( var j = 0; j < arr.length; j++) { if (arr[j][2] == val) { return arr[j][0]; } } return ""; } var me = this; this.$ = function(o) { return document.getElementById(o); } this.sub = function (i, pid) { for (var j=i+1; j<sel.length; j++) { me.$(sel[j]).length = 0; me.$(sel[j]).options[0] = new Option("请选择省,直辖市", ""); if(j=0) { me.$(sel[j]).options[0] = new Option("请选择省,直辖市", ""); } if(j=1) { me.$(sel[j]).options[0] = new Option("市,直辖市", ""); } if(j=2) { me.$(sel[j]).options[0] = new Option("县", ""); } } for ( var j = 0; j < arr.length; j++) { if (arr[j][1] == pid) { me.$(sel[i+1]).options[me.$(sel[i+1]).length] = new Option(arr[j][2], arr[j][0]); } } } this.init = function() { me.sub(-1,"root"); for (var i=0; i<sel.length-1; i++) {