ฟังก์ชันVBScript CreateObject
❮ การอ้างอิง VBScript ที่สมบูรณ์ฟังก์ชัน CreateObject สร้างวัตถุประเภทที่ระบุ
ไวยากรณ์
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 |
ตัวอย่าง
ตัวอย่าง
การสร้างวัตถุนิพจน์ทั่วไป:
<%
txt="This is a beautiful day"
Set objReg=CreateObject("vbscript.regexp")
objReg.Pattern="i"
response.write(objReg.Replace(txt,"##"))
%>
ผลลัพธ์ของโค้ดด้านบนจะเป็น:
Th##s is a beautiful day
❮ การอ้างอิง VBScript ที่สมบูรณ์