Click here to Skip to main content
15,895,142 members
Home / Discussions / Web Development
   

Web Development

 
QuestionUsing JDBCDataGrid example and am trying to enable row selection Pin
tleyden@imagine.ie8-May-07 23:03
tleyden@imagine.ie8-May-07 23:03 
QuestionUser controls Pin
Ridge Howison8-May-07 11:33
Ridge Howison8-May-07 11:33 
AnswerRe: User controls Pin
Christian Graus8-May-07 18:17
protectorChristian Graus8-May-07 18:17 
QuestionUsing the SQLDataReader Pin
No-e8-May-07 6:01
No-e8-May-07 6:01 
AnswerRe: Using the SQLDataReader Pin
Fred_Smith8-May-07 7:31
Fred_Smith8-May-07 7:31 
GeneralRe: Using the SQLDataReader Pin
No-e8-May-07 7:37
No-e8-May-07 7:37 
GeneralRe: Using the SQLDataReader Pin
Fred_Smith8-May-07 8:24
Fred_Smith8-May-07 8:24 
QuestionReorder Items a Listbox Pin
ljuliuss8-May-07 5:59
ljuliuss8-May-07 5:59 
Greetings -

I'm a GIS specialist having to code a front end to a GIS application, and I've got what is probably a really simple question. If anyone can help me I would be indebted to you, and could pay you back by some GIS advice if you ever need it.

I found a cool set of scripts for Re-ordering a list box but I can't figure out if I put the Client Script into an .ASP page, how do I call the Server Script and have it return the new list order like is done in the demo?

Where do I put the Server Script, into the client script somewhere, or in its own file? If into its own file, what kind of file is it? I've tried many variations on this, and can't get it to work as the demo http://www.siteexperts.com/tips/elements/ts32/page1.asp[^] does.

thanks in advance,
LJ

****Client Script****



//Copyright 2000 InsideDHTML.com, LLC. All rights reserved.

function outputList(ar, name, size) {
var strIDs = "<SELECT SIZE=\"" + size + "\" NAME=\"ro_lst" + name + "\">"
var sel = " SELECTED"
for (var i=0;i<ar.length;i++) {
strIDs += "<OPTION " + sel + " VALUE=\"" + ar[i][0] + "\">" + ar[i][1]
sel = ""
}
strIDs+="</SELECT>"
strIDs+="<INPUT NAME=\"" + name + "\" TYPE=hidden>"
return strIDs
}

function outputButton(bDir,name,val) {
return "<INPUT TYPE=button VALUE=\"" + val + "\" ONCLICK=\"move(this.form," + bDir + ",'" + name + "')\">"
}

function move(f,bDir,sName) {
var el = f.elements["ro_lst" + sName]
var idx = el.selectedIndex
if (idx==-1)
alert("You must first select the item to reorder.")
else {
var nxidx = idx+( bDir? -1 : 1)
if (nxidx<0) nxidx=el.length-1
if (nxidx>=el.length) nxidx=0
var oldVal = el[idx].value
var oldText = el[idx].text
el[idx].value = el[nxidx].value
el[idx].text = el[nxidx].text
el[nxidx].value = oldVal
el[nxidx].text = oldText
el.selectedIndex = nxidx
}
}

function processForm(f) {
for (var i=0;i<f.length;i++) {
var el = f[i]
if (el.name.substring(0,6)=="ro_lst") {
var strIDs = ""
for (var j=0;j<f[i].options.length;j++)
strIDs += f[i].options[j].value + ", "
f.elements[f.elements[i].name.substring(6)].value = strIDs.substring(0,strIDs.length-2)
}
}
}



var arrList = new Array()
arrList[0] = new Array("1","Test Item 1")
arrList[1] = new Array("2","Test Item 2")
arrList[2] = new Array("3","Test Item 3")
arrList[3] = new Array("4","Test Item 4")
arrList[4] = new Array("5","Test Item 5")
arrList[5] = new Array("6","Test Item 6")

document.write(outputButton(true,"test","Move Up") + "<BR>")
document.write(outputList(arrList,"test",10) + "<BR>")
document.write(outputButton(false,"test","Move Down"))






****Server Script****

Dim arItems,i, strIDs

strIDs = request.form("test")

if strIDs="" then
' Initialize
strIDs = "1, 2, 3, 4, 5, 6"
else
response.write("

Reordered....")
end if

arItems = split(strIDs,", ")

response.write("" & chr(13) & chr(10))
response.write("var arrList = new Array()" & chr(13) & chr(10))
for i=0 to uBound(arItems)
response.write("arrList[" & i & "] = new Array(""" & arItems(i) &
""",""Test Item " & arItems(i) & """)" & chr(13) & chr(10))
next


QuestionVBScript in an external file Pin
#realJSOP8-May-07 4:17
mve#realJSOP8-May-07 4:17 
AnswerRe: VBScript in an external file Pin
andyharman8-May-07 4:36
professionalandyharman8-May-07 4:36 
GeneralRe: VBScript in an external file Pin
#realJSOP8-May-07 4:56
mve#realJSOP8-May-07 4:56 
QuestionForm Confusion Pin
No-e8-May-07 4:11
No-e8-May-07 4:11 
AnswerRe: Form Confusion Pin
Guffa8-May-07 6:02
Guffa8-May-07 6:02 
GeneralRe: Form Confusion Pin
No-e8-May-07 6:04
No-e8-May-07 6:04 
Questionscrollable div Pin
xxrono8-May-07 4:09
xxrono8-May-07 4:09 
AnswerRe: scrollable div Pin
#realJSOP8-May-07 4:14
mve#realJSOP8-May-07 4:14 
GeneralRe: scrollable div Pin
xxrono8-May-07 4:42
xxrono8-May-07 4:42 
GeneralRe: scrollable div Pin
#realJSOP8-May-07 4:58
mve#realJSOP8-May-07 4:58 
GeneralRe: scrollable div Pin
RichardGrimmer8-May-07 5:51
RichardGrimmer8-May-07 5:51 
GeneralRe: scrollable div Pin
xxrono8-May-07 6:08
xxrono8-May-07 6:08 
GeneralRe: scrollable div Pin
#realJSOP8-May-07 6:28
mve#realJSOP8-May-07 6:28 
GeneralRe: scrollable div Pin
xxrono8-May-07 7:24
xxrono8-May-07 7:24 
GeneralRe: scrollable div Pin
RichardGrimmer8-May-07 21:45
RichardGrimmer8-May-07 21:45 
GeneralRe: scrollable div Pin
xxrono8-May-07 23:51
xxrono8-May-07 23:51 
GeneralRe: scrollable div Pin
RichardGrimmer9-May-07 5:22
RichardGrimmer9-May-07 5:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.