Application object in vbscript

Ruingwringe

New Member
I have to modify a page in that is using vbscript.I have a problem to set local variable to Application object in function. Code \[code\]Set LocalSchema = Application("ObjectSchema")\[/code\] generate an error, while \[code\]Set Schema = Application("ObjectSchema")\[/code\] works absolutly fine.Does anybody knows what is wrong? Is it any limitation for access to Application objects from function?Here is a complete code\[code\]<!DOCTYPE html><html><head><title></title> <style type="text/css"> .style1 { width: 87px; } </style></head><body><script type="text/vbscript">Option ExplicitDim ObjectSchemaDim strXML, strXML1Dim sUserIdOn Error Resume Nextfunction GetUserID() GetUserID = "{3450E0D8-EE30-48EE-B63F-486506AD1D97}"end functionfunction getObjectSchema() Dim LocalSchema Set LocalSchema = Application("ObjectSchema") If LocalSchema Is Nothing Then Set LocalSchema = CreateObject("Scripting.Dictionary") End if If LocalSchema.Exists(sUserId) Then strXML = LocalSchema.Item(sUserId) Else strXML = "<head><title>Title</title></head><head1><title1>Title1</title1></head1>" LocalSchema.Add sUserId, strXML Set Application("ObjectSchema") = LocalSchema End if getObjectSchema = strXMLend functionsUserId = GetUserID()strXML = ""strXML1 = ""strXML = getObjectSchema()strXML1 = getObjectSchema()strXML = getObjectSchema()strXML1 = getObjectSchema()Dim SchemaSet Schema = Application("ObjectSchema")If Schema Is Nothing Then Set Schema = CreateObject("Scripting.Dictionary") End ifIf Schema.Exists(sUserId) Then strXML = LocalSchema.Item(sUserId)Else strXML = "<head><title>Title</title></head><head1><title1>Title1</title1></head1>" Schema.Add sUserId, strXML Set Application("ObjectSchema") = SchemaEnd if strXML1 = strXML</script></body></html>\[/code\]
 
Back
Top