Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use XMLHTTP to realize two-level linkage Select

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article introduces the relevant knowledge of "how to use XMLHTTP to achieve two-level connected Select". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Using XMLHTTP. We can achieve a lot of good ideas.

This article. Realize the two-level linkage Select.

The traditional two-level linkage is to send all the data to the client..

Using XMLHTTP. We can return the data we need in real time.

Select.htm

The code is as follows:

Function GetResult (str)

{

/ *

*-GetResult (str)-

* GetResult (str)

* function: send a request through XMLHTTP and return the result.

* parameters: str, string, sending condition.

* instance: GetResult (document.all.userid.value)

* author:wanghr100 (grey bean baby. Net)

* update:2004-5-27 19:02

*-GetResult (str)-

, /

Var oBao = new ActiveXObject ("Microsoft.XMLHTTP")

OBao.open ("POST", "Server.asp?sel=" + str,false)

OBao.send ()

/ / the server-side processing returns a string encoded by escape.

/ / return data through XMLHTTP and start building Select.

BuildSel (unescape (oBao.responseText), document.all.sel2)

}

Function BuildSel (str,sel)

{

/ *

*-BuildSel (str,sel)-

* BuildSel (str,sel)

* function: build Select through str.

* Parameter: str, string, returned by the server. There is a specific structure "string 1, string 2, string 3"

* Parameter: sel, the Select to be built

* instance: BuildSel (unescape (oBao.responseText), document.all.sel2)

* author:wanghr100 (grey bean baby. Net)

* update:2004-5-27 19:02

*-BuildSel (str,sel)-

, /

/ / clear the original data first.

Sel.options.length=0

Var arrstr = new Array ()

Arrstr = str.split (",")

/ / start building a new Select.

For (var iTuno Bandi)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report