Hàm CreateObject của VBScript
❮ Tham khảo VBScript hoàn chỉnhHàm CreateObject tạo một đối tượng thuộc loại được chỉ định.
Cú pháp
CreateObject(servername.typename[,location])
Parameter | Description |
---|---|
servername | Required. The name of the application that provides the object |
typename | Required. The type/class of the object |
location | Optional. Where to create the object |
Ví dụ
Ví dụ
Tạo một đối tượng biểu thức chính quy:
<%
txt="This is a beautiful day"
Set objReg=CreateObject("vbscript.regexp")
objReg.Pattern="i"
response.write(objReg.Replace(txt,"##"))
%>
Đầu ra của đoạn mã trên sẽ là:
Th##s is a beautiful day
Hiển thị ví dụ »❮ Tham khảo VBScript hoàn chỉnh