XML在ASP中的一些运用
来源: 时间:06-12-25 点击: 点击这里收藏本文
Response.Write "<BR>Error" & Err.Number
Response.Write "<BR>" & Err.Description
Response.Write "<BR>" & Err.Source
Response.End
End If
Response.Write "<BR>cnnState=" & scrip.cnnState & "<BR>"
Response.Write "<BR>Testing ...Write<BR>"
scrip.TestWriteLine ""
scrip.TestWrite "This is the first part "
scrip.TestWrite "and this is the second."
Response.Write "<BR>Testing ...WriteLine<BR>"
scrip.TestWriteLine "This is text with a line break."
scrip.TestWriteLine "And so is this."
%>
上面的代码没有包括<implement type = "ASP"/>, 但是仍然可以访问ASP对象。
因为他们是被当成对象传递给scriptlet.
下面再给出一个很常用的取时间的狸子:
scp_dmy.sct
<?XML version="1.0"?>
<scriptlet>
<?scriptlet error="true" debug="true"?>
<registration
description="scp_dmy"
progid="scpdmy.Scriptlet"
version="1.00"
classid="{bba68a50-3ae0-11d3-a9c0-0080c8034244}"
>
</registration>
<public>
<method name = "option_num">
<PARAMETER name = "num"/>
</method>
<method name = "option_month">
</method>
<method name = "option_year">
</method>
</public>
<implements type="ASP" id="ASP"/>
<script language="VBScript">
<![CDATA][
Sub option_num(num)
For i = 1 to num
If i<10 Then
x = 0 & i
Else
x = i
End If
Response.write "<option value = " & x & ">" & x & "</option>"
Next
End Sub
Sub option_month()
For i = 1 to 12
If i<10 Then
x = 0 & i
Else
x = i
End If
Response.write "<option value = " & x & ">" & MonthName(x,True) & "</option>"
Next
End Sub
Sub option_year()
For i = -1 To 3
yy = year(DateAdd("yyyy",i,Date()))
Response.write "<option value = " & yy & ">" & yy & "</option>"
Next
End Sub
]]>
</script>
</scriptlet>
Dmy_check.asp: 文件
<%
Set scrip = Server.CreateObject("scp_dmy.Scriptlet")
%>
<html>
<head></head>
<body>
<form name = "form1">
从 :
<select name = "D1">
<option value="">dd</option>
<% call scrip.option_num(31) %>
</select>
<select name = "M1">
<option value="">mm</option>
<% call scrip.option_month() %>
</select>
<select name = "Y1">
<option value="">yy</option>
<% call scrip.option_year() %>
把此文章收藏到: