大型DropDown滚动列表 [英] Large DropDown Scrolling List

查看:62
本文介绍了大型DropDown滚动列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好


我们在ASP页面上有下拉菜单。问题是我们在

下拉列表中有大约900个项目。滚动浏览列表的用户过去对

感到非常沮丧。


有人可以建议是否有其他方式实现下拉菜单

数据主义者和我们一样大。


我在VB中寻找类似于列表框的东西,你可以开始输入

字符和数据库相应地移动,直到你找到了你想要的



ASP / HTML中是否有任何东西可以实现类似的功能


谢谢

Hi There

We have dropdown on ASP page. The problem is we have about 900 items in the
dropdown. Users scrolling through the list have become very frustrated in
the past.

Can someone suggest if there is another way of implement a dropdown where
the datalist is as big as ours.

I am looking for something like a listbox in VB where you can start typing
the characters and the databelow moves accordingly until you have found what
you want.

Is there anything in ASP/HTML to achieve a similar functionality

thanks


推荐答案

JP Singh写道:
J P Singh wrote:
你好

我们在ASP页面上有下拉菜单。问题是我们在下拉列表中有大约900个项目。滚动列表的用户过去已经变得非常沮丧。

有人可以建议是否有另一种实现下拉的方式
数据主义者和我们一样大。

我在VB中寻找类似于列表框的东西,你可以开始输入字符,数据库也会相应地移动,直到你找到你想要的东西为止。

ASP / HTML中是否有任何东西可以实现类似的功能
Hi There

We have dropdown on ASP page. The problem is we have about 900 items
in the dropdown. Users scrolling through the list have become very
frustrated in the past.

Can someone suggest if there is another way of implement a dropdown
where the datalist is as big as ours.

I am looking for something like a listbox in VB where you can start
typing the characters and the databelow moves accordingly until you
have found what you want.

Is there anything in ASP/HTML to achieve a similar functionality



您可以在客户端代码中执行此操作。转到
http:// www.thrasherwebdesign.com/ind...s&hp=links.asp

下载我的动态列表框演示以查看一种方法。谷歌搜索

应该找到你的其他例子。
http://www.learnasp.com/learn/listdynamicmore.asp

Bob Barrows


You can do this in client-side code. Go to
http://www.thrasherwebdesign.com/ind...s&hp=links.asp and
download my dynamic listbox demo to see one way of doing it. A Google search
should find you other examples.
http://www.learnasp.com/learn/listdynamicmore.asp

Bob Barrows


JP Singh在2003年9月19日写的

microsoft.public.inetserver.asp.general:
J P Singh wrote on 19 sep 2003 in
microsoft.public.inetserver.asp.general:
我们在ASP页面上有下拉列表。问题是我们在下拉列表中有大约900个项目。滚动列表的用户过去已经变得非常沮丧。

有人可以建议是否有另一种实现下拉的方式
数据主义者和我们一样大。

我在VB中寻找类似于列表框的东西,你可以开始输入字符,数据库也会相应地移动,直到你找到你想要的东西为止。

ASP / HTML中是否有任何东西可以实现类似的功能
We have dropdown on ASP page. The problem is we have about 900 items
in the dropdown. Users scrolling through the list have become very
frustrated in the past.

Can someone suggest if there is another way of implement a dropdown
where the datalist is as big as ours.

I am looking for something like a listbox in VB where you can start
typing the characters and the databelow moves accordingly until you
have found what you want.

Is there anything in ASP/HTML to achieve a similar functionality




Serverside编码无法帮助你这么好问一下客户端

[javascript?] ng。


ASP功能会在每次按键时向服务器进行往返。


Clientside VBS只能帮助IE用户,顺便说一下。


-

Evertjan。

荷兰。

(请更改我的电子邮件地址中的点'x''点数



Serverside coding cannot help you here so better ask a clientside
[javascript?] ng.

ASP functionality would make a roundtrip to the server on every keypress.

Clientside VBS only helps the IE users, btw.

--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)


鲍勃巴罗斯你好,


我去试用了你的ListDemo ASP 。我的熟练程度

在asp / vbscript / xml中有点微薄。我的脚本出现了错误

消息。我输入服务器名称,ID,
pwrd,以及列出的一两个字母并输出错误。我将
放入一堆msgbox语句进行调试。我可以在1st if之间获得

和第二个如果在sub txtCrit_onkeyup
下面的客户端脚本中的
。错误信息说:


" errorCode = -1072896759

reason =缺少必需的空格。


Line = 2

linepos = 55

filepos = 56

srcText =<!DOCTYPE HTML PUBLIC" - // WC3 // DTD HTML 3.2

最终// EN">"


DTD中出现此错误?这是你的脚本。如果我可以让它在我的系统上工作,那将是非常酷的。


<%@ Language = VBScript%>

<%Response.Buffer = true%>


< HTML>

< HEAD>

< META name =" VI60_DefaultClientScript" Content =" VBScript">


< META NAME =" GENERATOR" Content =" Microsoft Visual Studio

6.0">

< SCRIPT ID = clientEventHandlersVBS LANGUAGE = vbscript>

<! - -

dim sCurCrit

dim xmldoc

子window_onload

dim f

sUser = txtUser

sPwd = txtPwd

sServer = txtServer

if screen.availWidth> 800然后

tblMain.style.fontSize =" 10pt"

结束如果

lstTitles.style.visibility =" visible"

设置xmldoc =无

End Sub


Sub txtCrit_onkeyup

dim sOptions,sKey,sCrit,oOption ,oNodes,xmlFilt,

oNode,iCritLength

msgbox"输入txtCrit" ''我的第一个错误陷阱


''当我输入单个

字符时,我有这个设置来检索数据。

''有6000行,你可能想把它增加到两个

个字符


sCrit = txtCrit.value

清单

sKey = chr(window.event.keyCode)


msgbox"第一个if和len sCrit是" &安培; len(sCrit)&

和sKey是 &安培; sKey''我的第二个错误陷阱


if len(sCrit)> 1然后''换成6行换6000行

''检查一下是否有人打了2个字母这么近

一起说是elseif代码

''从未有机会执行并创建xmlDoc


msgbox" 2nd if" ''第三个错误陷阱

如果不是xmlDoc什么都没有那么

设置xmlFilt = CreateObject(" Microsoft.XMLDOM")

''The如果您愿意,可以用xslt

转换替换以下内容

set xmlFilt.documentelement = xmlFilt.createelement

(" rows" )

iCritLength = len(sCrit)

为xmldoc.documentelement.childnodes中的每个oNode
如果剩下
(oNode.getattribute

(" customerid"),iCritLength)= ucase(sCrit)然后

xmlFilt.documentelement.appendchild

oNode.Clonenode(false)

结束如果

next

msgbox" xmlFilt"

fillList xmlFilt

set xmlFilt = nothing

else

sCurCrit = sCrit

set xmldoc = CreateObject(" Microsoft.XMLDOM")

if RetrieveData (sCurCrit,xmldoc)然后

msgbox" xmldoc1"

fillList(xmldoc)

如果

结束如果

elseif len(sCrit)> 0然后''变为1表示6000行

如果sCrit<> sCurCrit然后

sCurCrit = sCrit

如果RetrieveData(sCurCrit,xmldoc)那么

msgbox" xmldoc2"

fillList(xmldoc)

结束如果

else

msgbox" xmldoc3"

fillList xmldoc

结束如果

结束如果

结束子

- >

< / SCRIPT> ;

< SCRIPT LANGUAGE = vbscript>

<! -

Sub ClearList

lstTitles.innerHTML =""

End Sub


Sub fillList(pxmlDoc)

''您可以使用数据岛和将

列表框绑定到它,但

''我选择这样做

dim oNode

对于pxmlDoc.documentelement.childnodes中的每个oNode

set oOption = document.createElement(" OPTION&qu​​ot;)

oOption.value = oNode.GetAttribute(" orderid")

oOption.text = oNode.GetAttribute(" customerid")& _

" - &安培; oNode.GetAttribute(" orderid")

lstTitles.options.add oOption

next

end sub


函数RetrieveData(psCrit,pxmlDoc)

dim oHTTP,xPE,bStatus,sUrl

RetrieveData = true

set oHTTP = CreateObject (Microsoft.XMLHTTP)

set pxmlDoc = CreateObject(" Microsoft.XMLDOM")

sUrl =" ListDemo_server.asp?P1 =" &安培; pscrit& "&安培;用户= QUOT; &

txtUser.value& _

"& Server =" &安培; txtServer.value& "&安培; PWD = QUOT; &安培; txtPwd.value


oHTTP.open" GET",sUrl,false

oHTTP.send

bStatus = pxmlDoc.loadXML (oHTTP.responsetext)

如果bStatus = false那么

设置xPE = pxmlDoc.parseError

strMessage =" errorCode =" &安培; xPE.errorCode& vbCrLf

strMessage = strMessage& reason = &安培; xPE.reason&

vbCrLf

strMessage = strMessage& Line = &安培; xPE.Line&

vbCrLf

strMessage = strMessage& " linepos =" &安培; xPE.linepos&

vbCrLf

strMessage = strMessage& " filepos =" &安培; xPE.filepos&

vbCrLf

strMessage = strMessage& srcText =" &安培; xPE.srcText&

vbCrLf

set xPE = nothing

MsgBox strMessage ,,检索数据

RetrieveData = false

结束如果

设置oHTTP =无

结束功能

- >

< / SCRIPT>

< / HEAD>

< BODY bgColor = lightgrey topMargin = 2 leftMargin = 2>

< DIV id = elHeading>< STRONG>< FONT color = blue face = Verdana

size = 3

style =" BORDER-TOP- WIDTH:thin">

订单维护< / FONT>< / STRONG>< / DIV>

< P>

< TABLE id = tblMain cellSpacing = 1 cellPadding = 1 width =" 75%"

border = 1>

< CAPTION>此演示使用订单Northwind中的表格

数据库< / CAPTION>

< TR>

< TD> SQL Server名称:< INPUT id = txtServer>< / TD>

< TD>用户名< INPUT id = txtUser>< / TD>

< TD>密码< INPUT id = txtPwd>< / TD>

< TR>

< TD>输入姓氏的前几个字母

您希望查看或编辑其客户ID的数据

:< BR>< INPUT id = txtCrit

name = text1>< / TD>

< TD colspan = 2>< SELECT id = lstTitles style =" VISIBILITY:

hidden;宽度:252px

尺寸= 8>< / SELECT>

< / TD>

< / TR>

< / TABLE>< / P>

< / BODY>

< / HTML>


感谢您分享您的剧本。

Rich
Hello to Bob Barrows,

I went and tried out your ListDemo asp. My proficiency
in asp/vbscript/xml is kind of meager. I got an error
message with your script. I type in server name, ID,
pwrd, and one or two letters to list on and error out. I
placed a bunch of msgbox statements to debug. I can get
between the "1st if" and "2nd If" in sub txtCrit_onkeyup
in your clientside script below. Error message says:

"errorCode = -1072896759
reason=Required white space was missing.

Line =2
linepos = 55
filepos = 56
srcText = <!DOCTYPE HTML PUBLIC "-//WC3//DTD HTML 3.2
Final//EN">"

Is this error in the DTD? Here is your script. It would
be real cool if I could get it to work on my system.

<%@ Language=VBScript %>
<%Response.Buffer=true%>

<HTML>
<HEAD>
<META name="VI60_DefaultClientScript" Content="VBScript">

<META NAME="GENERATOR" Content="Microsoft Visual Studio
6.0">
<SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
<!--
dim sCurCrit
dim xmldoc
Sub window_onload
dim f
sUser = txtUser
sPwd = txtPwd
sServer = txtServer
if screen.availWidth > 800 then
tblMain.style.fontSize="10pt"
end if
lstTitles.style.visibility="visible"
set xmldoc = nothing
End Sub

Sub txtCrit_onkeyup
dim sOptions, sKey, sCrit, oOption, oNodes,xmlFilt,
oNode,iCritLength

msgbox "entering txtCrit" ''my first error trap

''I have this set to retrieve data when there''s a single
character entered.
''With 6000 rows, you may want to increase this to two
characters

sCrit=txtCrit.value
ClearList
sKey = chr(window.event.keyCode)

msgbox "1st if and len of sCrit is " & len(sCrit) & "
and sKey is " & sKey ''my second error trap

if len(sCrit) > 1 then ''change to 2 for 6000 rows
''check to see if someone hit 2 letters so close
together that the elseif code
''never had a chance to execute and create xmlDoc

msgbox "2nd if" ''third error trap
if not xmlDoc is nothing then
set xmlFilt = CreateObject("Microsoft.XMLDOM")
''The following can be replaced by an xslt
transformation if you are so inclined
set xmlFilt.documentelement = xmlFilt.createelement
("rows")
iCritLength = len(sCrit)
for each oNode in xmldoc.documentelement.childnodes
if left(oNode.getattribute
("customerid"),iCritLength) = ucase(sCrit) then
xmlFilt.documentelement.appendchild
oNode.Clonenode(false)
end if
next
msgbox "xmlFilt"
fillList xmlFilt
set xmlFilt = nothing
else
sCurCrit = sCrit
set xmldoc = CreateObject("Microsoft.XMLDOM")
if RetrieveData(sCurCrit,xmldoc) then
msgbox "xmldoc1"
fillList(xmldoc)
end if
end if
elseif len(sCrit) > 0 then ''change to 1 for 6000 rows
if sCrit <> sCurCrit then
sCurCrit = sCrit
if RetrieveData(sCurCrit,xmldoc) then
msgbox "xmldoc2"
fillList(xmldoc)
end if
else
msgbox "xmldoc3"
fillList xmldoc
end if
end if
End Sub
-->
</SCRIPT>
<SCRIPT LANGUAGE=vbscript>
<!--
Sub ClearList
lstTitles.innerHTML=""
End Sub

Sub fillList(pxmlDoc)
''you could have used a data island and bound the
listbox to it, but
''I chose to do it this way
dim oNode
for each oNode in pxmlDoc.documentelement.childnodes
set oOption = document.createElement("OPTION")
oOption.value = oNode.GetAttribute("orderid")
oOption.text = oNode.GetAttribute("customerid") & _
" - " & oNode.GetAttribute("orderid")
lstTitles.options.add oOption
next
end sub

Function RetrieveData(psCrit, pxmlDoc)
dim oHTTP,xPE,bStatus, sUrl
RetrieveData = true
set oHTTP = CreateObject("Microsoft.XMLHTTP")
set pxmlDoc = CreateObject("Microsoft.XMLDOM")
sUrl = "ListDemo_server.asp?P1=" & pscrit & "&User=" &
txtUser.value & _
"&Server=" & txtServer.value & "&PWD=" & txtPwd.value

oHTTP.open "GET",sUrl, false
oHTTP.send
bStatus= pxmlDoc.loadXML(oHTTP.responsetext )
if bStatus = false then
Set xPE = pxmlDoc.parseError
strMessage = "errorCode = " & xPE.errorCode & vbCrLf
strMessage = strMessage & "reason = " & xPE.reason &
vbCrLf
strMessage = strMessage & "Line = " & xPE.Line &
vbCrLf
strMessage = strMessage & "linepos = " & xPE.linepos &
vbCrLf
strMessage = strMessage & "filepos = " & xPE.filepos &
vbCrLf
strMessage = strMessage & "srcText = " & xPE.srcText &
vbCrLf
set xPE = nothing
MsgBox strMessage,,"Retrieving Data"
RetrieveData=false
end if
set oHTTP = nothing
end function
-->
</SCRIPT>
</HEAD>
<BODY bgColor=lightgrey topMargin=2 leftMargin=2>
<DIV id=elHeading><STRONG><FONT color=blue face=Verdana
size=3
style="BORDER-TOP-WIDTH: thin">
Orders Maintenance </FONT></STRONG></DIV>
<P>
<TABLE id=tblMain cellSpacing=1 cellPadding=1 width="75%"
border=1>
<CAPTION>This demo uses the Orders table in the Northwind
database</CAPTION>
<TR>
<TD>SQL Server Name: <INPUT id=txtServer></TD>
<TD> User Name <INPUT id=txtUser></TD>
<TD> Password <INPUT id=txtPwd></TD>
<TR>
<TD>Enter the first few letters of the last name of
the customer id whose data
you wish to view or edit:<BR><INPUT id=txtCrit
name=text1></TD>
<TD colspan=2><SELECT id=lstTitles style="VISIBILITY:
hidden; WIDTH: 252px"
size=8></SELECT>
</TD>
</TR>
</TABLE></P>
</BODY>
</HTML>

Thanks for sharing your script.
Rich
-----原始消息-----
JP Singh写道:
-----Original Message-----
J P Singh wrote:
您好

我们在ASP页面上有下拉菜单。问题是我们在下拉列表中有
约900项。滚动浏览列表的用户在过去会变得非常沮丧。

有人可以建议,如果有另一种
的方式实现一个数据列表与我们一样大的下拉列表。

我在VB中寻找类似于列表框的东西,其中
你可以开始输入字符,数据库也相应地移动
,直到找到你想要的东西为止。

ASP / HTML中是否有任何东西可以实现类似的
功能你可以在客户端代码中执行此操作。转到
http://www.thrasherwebdesign.com/index.asp?



pi = links& hp = links.asp anddownload我的动态列表框演示看到一种方式做
吧。 Google搜索会找到其他示例。
http:// www。 learnasp.com/learn/listdynamicmore.asp

鲍勃巴罗斯


pi=links&hp=links.asp anddownload my dynamic listbox demo to see one way of doing it. A Google searchshould find you other examples.
http://www.learnasp.com/learn/listdynamicmore.asp

Bob Barrows
.



这篇关于大型DropDown滚动列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆