在VBScript字典类型不匹配
-
22-09-2019 - |
题
我收到的错误是:类型不匹配:样式表“
样式被定义为:
sub stylesheets(collection)
for each key in collection.Keys
response.write(stylesheet(key, collection.Item(key)))
next
end sub
' returns a link tag for each object in the collection
function stylesheet(asset, media_type)
if (media_type="") then
media_type="screen"
end if
return "<link href=""" & asset_url(asset) & """ type=""text/css"" media=""" _
& media_type & """ />"
end function
和它被称为例如:
<% stylesheets(site_stylesheets) %>
其中site_stylesheets已被定义为:
' stylesheets is a collection of the stylesheets to be included on all pages
Set site_stylesheets = CreateObject("Scripting.Dictionary")
site_stylesheets.Add "css/endoworks.css", "screen"
这是一个很长的时间,因为我做了任何的VBScript-ING。我真的很感谢所有帮助。
解决方案 2
我结束了刚刚放置环路逻辑从stylesheets
入header
子[例程]。现在工作得很好。
@ Tester101:我想你的建议,但他们并没有解决问题。
编辑:其实我发现,我原来在stylesheets
子程序这哪里是header
子被称为stylesheets
说法。因此,它试图用site_stylesheets的参数执行nothing
。真不敢相信我错过了。
其他提示
尝试调用的样式表时去除括号。看到这个问题,以了解更多信息。我不认为只有一个参数调用子时可以使用括号。
尝试这
<% stylesheets site_stylesheets %>
或这
<% call stylesheets(site_stylesheets) %>
不隶属于 StackOverflow