anyone here knows how to store ASP collection to Javascript collection? I got a code from my previous post but didn’t put it to work i must have put the codes in the wrong places.
Im currently developing an app wherein once the document is ready each variable from the ASP colection will move down one at a time. I decided to use jquery to slide down each value since it has a slideDown event. but when i slide down the items from the collection slides down all at the same time. anyone here has an idea on how to do this or suggestions on a better way to do this?
<%
Dim objDictionary, Key,searchWord, myVar,a,i, break
searchWord = request.QueryString("searchWord")
Set objDictionary = CreateObject("Scripting.Dictionary")
objDictionary.CompareMode=1
objDictionary.Add "Hello","hello"
objDictionary.Add "Age","age"
objDictionary.Add "height","height"
objDictionary.Add "sample","sample"
objDictionary.Add "words","words"
Response.Write "<div id='toFall'>"
if objDictionary.Exists(searchWord) then
objDictionary.Remove(searchWord)
a = objDictionary.Keys
for i=0 to objDictionary.Count-1
Response.Write( "<div class='fall'>" + a(i))
Response.write("<br />")
Response.write("</div>")
next
set objDictionary=nothing
else
a = objDictionary.Keys
for i=0 to objDictionary.Count-1
Response.Write( "<div class='fall'>" + a(i))
Response.write("<br />")
Response.write("</div>")
next
set objDictionary=nothing
end if
Response.write "</div>"
'got this code from my previous post but didn't got it working
Sub CollectionToJavaScript(oCollection, sClientSideName)
Dim blnFirst
blnFirst = True
Response.Write("<" & "script" & " type=""text/javascript"">")
Response.Write("var " & sClientSideName & " = {")
For Each key In objDictionary.Keys
If Not(blnFirst) Then Response.Write(", ")
Response.Write( key & ": " & objDictionary(key) )
blnFirst = false
Next
Response.Write("};")
Response.Write("</" & "script>")
Call CollectionToJavaScript (objDictionary, "myCollection")
End Sub
%>
There were several mistakes in your code:
The postioning of
Response.Write( key & “: ” & objDictionary(key) )
blnFirst = false