CreateObject

收藏:0   阅读:59

VBScript CreateObject 函数


CreateObject 函数创建一个指定类型的对象。

语法

CreateObject(servername.typename[,location])

参数 描述
servername 必需。提供此对象的应用程序名称。
typename 必需。对象的类型或类(type/class)。
location 可选。在何处创建对象。

实例

创建正则表达式对象:

<script type="text/vbscript">

txt="This is a beautiful day"
Set objReg=CreateObject("vbscript.regexp")
objReg.Pattern="i"
document.write(objReg.Replace(txt,"##"))

</script>

以上实例输出结果:

Th##s is a beautiful day

© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!