VBScript CreateObject function
CreateObject function creates a specified type of object.
grammar
CreateObject(servername.typename[,location])
参数 | 描述 |
---|---|
servername | 必需。提供此对象的应用程序名称。 |
typename | 必需。对象的类型或类(type/class)。 |
location | 可选。在何处创建对象。 |
Examples
Examples
Create a regular expression object:
<script type="text/vbscript">
txt="This is a beautiful day"
Set objReg=CreateObject("vbscript.regexp")
objReg.Pattern="i"
document.write(objReg.Replace(txt,"##"))
</script>
txt="This is a beautiful day"
Set objReg=CreateObject("vbscript.regexp")
objReg.Pattern="i"
document.write(objReg.Replace(txt,"##"))
</script>
Examples of the above output:
Th##s is a beautiful day
try it"
Complete VBScript Reference