função VBScript CreateObject
função CreateObject cria um tipo específico de objeto.
gramática
CreateObject(servername.typename[,location])
参数 | 描述 |
---|---|
servername | 必需。提供此对象的应用程序名称。 |
typename | 必需。对象的类型或类(type/class)。 |
location | 可选。在何处创建对象。 |
Exemplos
Exemplos
Criar um objeto de expressão regular:
<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>
Exemplos de saída acima:
Th##s is a beautiful day
tente »
Completa VBScript Referência