asp经典对象到javascript对象,并使对象向下滑动
asp classic object to javascript object and make objects slide down
这里有人知道如何将ASP集合存储到Javascript集合吗?我从上一篇文章中得到了一个代码,但没有把它用起来——我一定把代码放错了地方。
我目前正在开发一个应用程序,一旦文档准备好,ASP集合中的每个变量都会一次下移一个。我决定使用jquery来向下滑动每个值,因为它有一个slideDown事件。但当我向下滑动时,集合中的项目会同时向下滑动。这里有人对如何做到这一点有想法,或者对更好的方法有建议吗?
<%
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
%>
您的代码中有几个错误:
- 在调用CollectionToJavaScript子之前,您将dictionary对象设置为空
- 您需要在CollectionToJavaScript子中使用oCollection
-
的位置Response.Write(key&":"&objDictionary(key))
blnFirst=错误<% 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 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 end if Response.write "</div>" 'got this code from my previous post but didn't got it working Sub CollectionToJavaScript(ByRef oCollection, sClientSideName) Dim blnFirst blnFirst = True Response.Write("<" & "script" & " type=""text/javascript"">") Response.Write("var " & sClientSideName & " = {") For Each key In oCollection.Keys If Not(blnFirst) Then Response.Write(", ") End If Response.Write( key & ": " & oCollection(key) ) blnFirst = false Next Response.Write("};") Response.Write("</" & "script>") End Sub Call CollectionToJavaScript (objDictionary, "myCollection") set objDictionary=nothing %>
相关文章:
- 引用对象中的通用值
- jQuery匹配JSON对象的部分文本
- 节点导出返回一个空对象
- 如何在Javascript中将JSon对象转换为数组
- 我可以在json对象中添加一个函数吗
- 使用JS将数组转换为json对象
- 全局变量和全局对象的属性之间有什么区别吗
- 比较从函数和生成的日期对象
- Javascript,访问一个主要对象模块模式中的每个对象
- 如果使用 lodash 将属性存在于另一个对象中,则向对象添加属性
- 调整窗口大小时,可拖动的对象会出现在容器外部
- 如何使用javascript从主svg对象动态创建svg视图框
- asp经典对象到javascript对象,并使对象向下滑动
- 经典方法的目的|与对象状态的关系
- 使用javascript访问经典的asp应用程序对象
- "用于创建新对象的伪经典和原型范式“;.如何决定使用哪一个
- 用于构造代理对象的JavaScript模式,使用经典继承
- CoffeeScript -加载库与AMD或在窗口对象(经典方式)
- 经典继承和对象池
- 如何从经典ASP中调用COM对象函数