Asp.net implements the linkage control of Brushless newest DropDownList

Source: Internet
Author: User

I saw some new linkage controls on the Internet. After the test, English and numbers are displayed, but Chinese characters are not displayed. Later, I made a flip-over modification to the files that have been down from the Internet and made a linkage control for provinces and cities. Share it with you. Chinese characters are displayed.

Function load (state ){
Var drp2 = document. getElementById ("DropDownList2 ");
For (I = drp2.length; I & gt; = 0; I --){
Drp2.options. remove (I );
}

Var oHttpReq = new ActiveXObject ("MSXML2.XMLHTTP ");
Var oDoc = new ActiveXObject ("MSXML2.DOMDocument ");
// Here escape can solve Chinese problems
OHttpReq. open ("POST", "getData. aspx? State = "+ state, false );
OHttpReq. send ("");
Result = oHttpReq. responseText;
ODoc. loadXML (result );
Items1 = oDoc. selectNodes ("// CITY/Table/Id ");
Items2 = oDoc. selectNodes ("// CITY/Table/shiname ");

Var itemsLength = items1.length;
For (I = 0; I & lt; itemsLength; I ++)
// Assign the class name and number of the sub-class to DropDownList2
{
Var newOption = document. createElement ("OPTION ");
NewOption. text = items2 [I]. text;
NewOption. value = items1 [I]. text;
Drp2.options. add (newOption );
}
}
Window. onload = function () {load ('1 ');}
<% @ Page language = "c #" Codebehind = "Example. aspx. cs" AutoEventWireup = "false" Inherits = "Webs. other. Example" %>
<HTML>
<HEAD>
<Title> Example </title>
<Meta name = "GENERATOR" Content = "Microsoft Visual Studio. NET 7.1">
<Meta name = "CODE_LANGUAGE" Content = "C #">

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.