中国开发网: 论坛: 程序员情感CBD: 贴子 416489
茶壶: 没有。在IE里运行。解释器。
<?XML version="1.0"?>

<component id="ScriptletFactorial">

<registration progid="Component.Factorial"/>

<public>

<property name="sname"/>

<property name="age">

<get internalName="readAge"/>

</property>

<property name="dateOfBirth">

<get internalName="readDOB"/>

<put internalName="writeDOB"/>

</property>

<property name="mstatus">

<get/>

<put/>

</property>

</public>



<script language="VBScript">

<![CDATA[

Dim sname ' Read-write sname property (no functions).

Dim gDOB ' Global variable used to store date of birth.

Dim gMStatus ' global variable used to store marital status.



Function readDOB()

' Gets value of dateOfBirth property.

readDOB = gDOB

End Function



Function writeDOB(newDOB)

' Sets value of dateOfBirth property.

If isDate(gDOB) Then

' Error checking.

gDOB = newDOB

End If

End Function



Function readAge()

' Calculates read-only age property.

If isDate(gDOB) Then

dobM = DatePart("m", gDOB)

dobD = DatePart("d", gDOB)

dobY = DatePart("yyyy", gDOB)

todayY = DatePart("yyyy", Date)

age = todayY - dobY



' Adjust if birthday has not yet occurred this year.

bday = DateValue(dobM & "/" & dobD & "/" & todayY)

If DateDiff("d", bday, DateValue(Date)) < 0 Then

age = age - 1

End If

readAge = age

End If

End Function



Function get_mstatus()

' Reads value of mstatus property.

get_mstatus = gMStatus

End Function



Function put_mstatus(s)

' Writes value of mstatus property.

If s = "M" Or s = "S" Then

gMStatus = s

Else

gMStatus = "?"

End If

End Function

]]>

</script>

</component>

相关信息:


欢迎光临本社区,您还没有登录,不能发贴子。请在 这里登录