The code is as follows:
JScript
The code copy is as follows:
functionGenerateGuid(){
varTypeLib=newActiveXObject("Scriptlet.TypeLib");
return(TypeLib.Guid);
}
VBScript
The code copy is as follows:
FunctionGenerateGuid()
DimTypeLib
SetTypeLib=Server.CreateObject("Scriptlet.TypeLib")
GenerateGuid=TypeLib.Guid
EndFunction
If you want to use it on the client side, the VBScript code needs to be slightly modified, that is,:
SetTypeLib=Server.CreateObject("Scriptlet.TypeLib")
Modified to:
SetTypeLib=CreateObject("Scriptlet.TypeLib")
However, when the client uses ActiveX, the default security settings of IE will prompt whether to allow ActiveX, so it is not recommended to use it.
If it is an asp server, it can be
ASP (using vbs)
The code copy is as follows:
Function GUID()
Dim objTypeLib
Set objTypeLib = CreateObject("Scriptlet.TypeLib")
GUID = Left(CStr(objTypeLib.Guid),38)
Set objTypeLib = Nothing
End Function
ASP (using jscript) The code for creating a GUID on the server is as follows:
The code copy is as follows:
function GUID(){
return new ActiveXObject("Scriptlet.TypeLib").Guid.toString().substring(0,38);
}