Code As follows:
JScript
Copy code The Code is as follows: function generateguid (){
VaR typelib = new activexobject ("scriptlet. typelib ");
Return (typelib. guid );
}
VBScript Copy codeThe Code is as follows: function generateguid ()
Dim typelib
Set typelib = server. Createobject ("scriptlet. typelib ")
Generateguid = typelib. guid
End Function
If you want to use it on the client, the VBScript code needs to be slightly modified, namely:
Set typelib = server. Createobject ("scriptlet. typelib ")
To:
Set typelib = Createobject ("scriptlet. typelib ")
However, when the client uses ActiveX, the default security settings of IE will prompt whether ActiveX is allowed, so it is not recommended.
This can be done on the ASP server.
ASP (using vbs)Copy codeThe Code is as follows: function GUID ()
Dim objtypelib
Set objtypelib = Createobject ("scriptlet. typelib ")
Guid = left (CSTR (objtypelib. guid), 38)
Set objtypelib = nothing
End Function
The following code creates a guid for ASP (using JScript) on the server:Copy codeThe Code is as follows: function GUID (){
Return new activexobject ("scriptlet. typelib"). guid. tostring (). substring (0, 38 );
}