Test.asp
Function Removeall (ListBox) {? if (listbox == null) ?? Return;? listbox.selectedIndIndex = -1;? var ilistboxlength = listbox.Options.Length;? for (var i = 0; iListBoxLength; i ) ?? ListBox.Options.remove (0);
Function getStates (country) {? var szrequest = "
";? Var objHTTP = new ActiveXObject (" Microsoft.XMLHTTP ") ;? var szURL =" states.asp ";? Var szHttpMethod =" POST ";? ObjHTTP.Open (szHttpMethod, szURL, false) ;? objHTTP.SetRequestHeader ("Content-Type", "Application / X-WWW-FORM-URLENCODED");? Objhttp.send (szrequest);
? var szreply = objhttp.response =?? i (?? {?? // failure ?? szreply = "";?}? Return Szreply;
Function DisplayStates (StateSlist, Country) {? if (stateslist == null) ?? Return; statellist.selectedIndIndex = -1;
REMOVEALL (StateSlist)? Var xmlstates = getStates (country); Var objxmldom = new activXObject ("microsoft.xmldom") ;? if (! ObjxmLDom.LoadXML (XMLSTATES))? {???? var serr = "Response XML String is Messed Up / N " XMLSTATES; ?? Alert (SERR);?}? Else? {?? var nodes = objxmldom.selectNodes (" / response / state "); ?? for (var i = 0; I Function Display (obj) {? alert (obj.Options [obj.selected) ;? alert (obj.Options [obj.selected);} script> States.asp <% @ Language = jscript%> <% response.expires = 0;%> ? <% Function ProcessRequest () {var objXmlDOM = Server.CreateObject ( "Microsoft.XMLDOM") ;? var szXmlRequest = Request.Form;? // Response.Write (szXmlRequest);? // alert (szXmlRequest) ;? if (! objXmlDOM.loadXML (szXmlRequest))? {?? var sErrMsg = "Invalid XML Request String" szXmlRequest; ?? Response.Write (sErrMsg); ?? return;?}? var objRoot = objXmlDOM.selectSingleNode ( "/ Requeststates ") ;? if (objRoot == NULL)? {?? var serrmsg =" Invalid XML Request String (Request 7 Node Not Found " SZXMLREQUEST; ?? RESPONSE.WRITE (SERRMSG); ?? Return ;?}? Var country = objRoot.getattribute ("country") ;? IF (country == null) || (country == "))? {?? var serrmsg =" no country specified " szxmlRequest; ?? response. Write (serrmsg); ?? Return;?}? Var responsexml = "" ??? Var conn = server.createObject ("adoDb.connection"); ? Conn.open ("driver = {sql server}; server = (local); database = pubs; uid = sa; pwd =;"); //? var = Server.createObject ("adoDb.recordset"); //? var sqlstr = "select title_id from titles where type = '" country "" "; ? var = conn.execute ("SELECT TITLE_ID from Titles Where Type = '" Country ""); ? While (! rs.eof) { ???? responsexml = " RS ("Title_ID") " " ???? rs.movenext (); ? rs.close (); ? Conn.close (); ? Responsexml = " "" Response.write (responsexml) ;? objxmldom = null;} ProcessRequest ();%>