VBScript中的字典类型不匹配
我收到的错误是:类型不匹配:“样式表” 样式表定义为:VBScript中的字典类型不匹配,vbscript,dictionary,type-mismatch,Vbscript,Dictionary,Type Mismatch,我收到的错误是:类型不匹配:“样式表” 样式表定义为: 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(ass
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 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了。非常感谢您的帮助。调用样式表时,请尝试删除括号。有关更多信息,请参见问题。我认为当只使用一个参数调用sub时,不能使用括号 试试这个
<% stylesheets site_stylesheets %>
还是这个
<% call stylesheets(site_stylesheets) %>
我最后只是将
样式表
中的循环逻辑放入标题
子[例程]中。现在很好用
@测试人员101:我尝试了你的建议,但没有解决问题
编辑:我实际上发现我在头
子例程中有一个样式表
参数,它是调用样式表
子例程的地方。所以它试图用site_样式表参数执行nothing
。真不敢相信我错过了
<% call stylesheets(site_stylesheets) %>