?? class_html_form.asp
字號:
<%
'===================================================================
'= Description : Class's parameters define
'= Time : Created At OCT,19,2003
'= Change Log :
'= 2005-8-6 10:23 by cc
'= * 增加數據校驗自動生成 arrChk
'= 2005-8-6 14:55 by cc
'= * 把必填符號的位置放在輸入項后面
'= 必填符號在inc_config.asp定義
'= Const MUST_FILLED_CHAR = "*"
'= 2005-8-25 21:57 by cc
'= * 增加函數AddSelectByArray(strName,strValue,arrShow,arrValue,strSelFlag)
'= 從字符串中讀取記錄,作為下來選項,字符串中的可選項用逗號分隔
'= 2005-8-26 1:16 by cc
'= * 帶有提示的輸入項
'= Public Sub AddTdClew(strTdValue,strTdClass1,strTdClass2,strClew)
'===================================================================
%>
<!-- #include file = "./class_client_check.asp" -->
<%
Class classForm
Private strAction,strMethod,strId,strName,strOnSubmit,cssColumnScale
Private cssBtn,cssText,cssTextrea,cssSeleck,cssChkBox,cssRadio
Private bolSubmit
Private strTdValueChk '== 臨時存儲td value來校驗是否有*
Private strHtmlCode
Public arrDataChk '== 數據校驗數組
'===================================================================
'= Description : Class's initialization
'= Time : Created At OCT,19,2003
'= Modify :
'= Time Description
'===================================================================
Private Sub Class_Initialize()
strAction = "./"
strMethod = "post"
strId = ""
strName = ""
strOnSubmit = ""
strTdValueChk = ""
bolSubmit = True
cssBtn = GBL_cssIptBtn
cssText = GBL_cssIptText
cssTextrea = GBL_cssTextrea
cssSelect = GBL_cssSelect
cssChkBox = GBL_cssChkBox
cssRadio = GBL_cssRadio
cssColumnScale = GBL_cssColumnScale
End Sub
'===================================================================
'= Description : Class's terminate
'= Time : Created At OCT,19,2003
'= Modify :
'= Time Description
'===================================================================
Private Sub Class_Terminate()
strAction = "./"
strMethod = "post"
strId = ""
strName = ""
strOnSubmit = ""
strTdValueChk = ""
bolSubmit = True
Set strHtmlCode = Nothing
End Sub
'===================================================================
'= Description : Set members parameters
'= Time : Created At OCT,19,2003
'= Modify :
'= Time Description
'===================================================================
Public Property Let Action(value)
strAction = Trim(value)
End Property
Public Property Let Method(value)
strMethod = Trim(value)
End Property
Public Property Let Id(value)
strId = Trim(value)
End Property
Public Property Let DataChkArr(value)
ReDim arrDataChk(UBound(value))
Dim Flag
Flag = True
For i = LBound(value) To UBound(value)
arrDataChk(i) = value(i)
Flag = False
Next
If Flag = True Then
Set arrDataChk = Nothing
End If
End Property
Public Property Let Name(value)
strName = Trim(value)
End Property
Public Property Let OnSubmit(value)
strOnSubmit = Trim(value)
End Property
Public Property Let ColumnScale(value)
cssColumnScale = Trim(value)
End Property
Public Property Let IptBtn(value)
cssBtn = Trim(value)
End Property
Public Property Let IptText(value)
cssText = Trim(value)
End Property
Public Property Let Submit(value)
bolSubmit = Trim(value)
End Property
'===================================================================
'= Description : Set public functions and sub of class
'= Time : Created At OCT,19,2003
'= Modify :
'= Time Description
'===================================================================
Public Sub MakeForm()
'strHtmlCode = "<form action='" & strAction & "'"
'strHtmlCode = strHtmlCode & " method='" & strMethod & "'"
'strHtmlCode = strHtmlCode & " id=" & strId
'strHtmlCode = strHtmlCode & " name=" & strName
'If strOnSubmit <> "" Then
' strHtmlCode = strHtmlCode & " onsubmit='" & strOnSubmit & "'"
'End If
'strHtmlCode = strHtmlCode & ">[table]"
strHtmlCode = strHtmlCode & "[table]"
strHtmlCode = strHtmlCode & "<script language=JavaScript>var strNowForm = '" & strName & "'</Script>"
'strHtmlCode = strHtmlCode & "</form>"
End Sub
Public Sub MakeTable(strBorder,strPadding,strSpacing,strAlign,strWidth,strClass)
Dim strTmp
strTmp = "<table border=" & strBorder
strTmp = strTmp & " cellpadding=" & strPadding
strTmp = strTmp & " cellspacing=" & strSpacing
strTmp = strTmp & " align=" & strAlign
strTmp = strTmp & " width=" & strWidth
strTmp = strTmp & " class=" & strClass
strTmp = strTmp & " ><tbody>" & chr(13) & chr(10)
strTmp = strTmp & "<form action='" & strAction & "'"
strTmp = strTmp & " method='" & strMethod & "'"
strTmp = strTmp & " id=" & strId
strTmp = strTmp & " name=" & strName
If strOnSubmit <> "" Then
strTmp = strTmp & " onsubmit='" & strOnSubmit & "'"
End If
strTmp = strTmp & ">[tr]"
strTmp = strTmp & "</form>" & chr(13) & chr(10)
strTmp = strTmp & "</tbody></table>" & chr(13) & chr(10)
strHtmlCode = Replace(strHtmlCode,"[table]",strTmp)
End Sub
Public Sub MakeTableEasy()
Call MakeTable(strBorder,strPadding,strSpacing,strAlign,strWidth,strClass)
End Sub
Public Sub AddTr(strTrClass)
Dim strTmp
strHtmlCode = Replace(strHtmlCode,"[input]","")
strHtmlCode = Replace(strHtmlCode,"[value]","")
strHtmlCode = Replace(strHtmlCode,"value= ","")
strHtmlCode = Replace(strHtmlCode,"value=''","")
strHtmlCode = Replace(strHtmlCode,"value=>"," >")
strTmp = "<tr class=" & strTrClass & " >" & chr(13) & chr(10)
strTmp = strTmp & "[td]" & chr(13) & chr(10) & "</tr>[tr]"
strHtmlCode = Replace(strHtmlCode,"[tr]",strTmp)
End Sub
Public Sub AddTd(strTdValue,strTdClass1,strTdClass2)
Dim strTmp
strTdValueChk = strTdValue
strTdValue = Replace(strTdValue,MUST_FILLED_CHAR,"")
strTmp = "<td"
If strTdClass1 <> "" Then
strTmp = strTmp & " class=" & strTdClass1
End If
strTmp = strTmp & " width=" & cssColumnScale & " valign=top>"
If Trim(strTdValue) <> "" And Trim(strTdValue) <> "<br>" Then
strTmp = strTmp & strTdValue & ":"
End If
strTmp = strTmp & "</td>" & chr(13) & chr(10)
strTmp = strTmp & "<td"
If strTdClass2 <> "" Then
strTmp = strTmp & " class=" & strTdClass2
End If
strTmp = strTmp & " valign=top>" & chr(13) & chr(10)
strTmp = strTmp & "[input]</td>" & chr(13) & chr(10)
strHtmlCode = Replace(strHtmlCode,"[td]",strTmp)
End Sub
Public Sub AddTdClew(strTdValue,strTdClass1,strTdClass2,strClew)
Dim strTmp
strTdValueChk = strTdValue
strTdValue = Replace(strTdValue,MUST_FILLED_CHAR,"")
strTmp = "<td"
If strTdClass1 <> "" Then
strTmp = strTmp & " class=" & strTdClass1
End If
strTmp = strTmp & " width=" & cssColumnScale & " valign=top>"
If Trim(strTdValue) <> "" And Trim(strTdValue) <> "<br>" Then
strTmp = strTmp & strTdValue & ":"
End If
strTmp = strTmp & "</td>"
strTmp = strTmp & "<td"
If strTdClass2 <> "" Then
strTmp = strTmp & " class=" & strTdClass2
End If
strTmp = strTmp & " valign=top>"
strTmp = strTmp & "[input]" & strClew & "</td>"
strHtmlCode = Replace(strHtmlCode,"[td]",strTmp)
End Sub
Public Sub AddTitle(strTitle,strTitleClass)
Dim strTmp
strTmp = "<td"
If strTitleClass <> "" Then
strTmp = strTmp & " class=" & strTitleClass
End If
strTmp = strTmp & " colspan=2>" & chr(13) & chr(10)
strTmp = strTmp & CONST_TITLE_CHAR & " " & Trim(strTitle) & " " & CONST_TITLE_CHAR & "</td>" & chr(13) & chr(10)
strHtmlCode = Replace(strHtmlCode,"[td]",strTmp)
End Sub
Public Sub AddText(strName,strMaxLen,strSize)
Dim strTmp
strTmp = "<input type='text' maxlength=" & strMaxLen
strTmp = strTmp & " size=" & strSize
strTmp = strTmp & " name=" & strName
strTmp = strTmp & " class=" & cssText & " value='[value]'>"
If InStr(strTdValueChk,MUST_FILLED_CHAR) Then
strTmp = strTmp & " <font color=red>*</font>"
End If
strHtmlCode = Replace(strHtmlCode,"[input]",strTmp)
End Sub
Public Sub AddHidden(strName)
Dim strTmp
strTmp = "<input type='hidden' name='" & strName & "'"
strTmp = strTmp & " value='[value]'>" & chr(13) & chr(10)
strHtmlCode = Replace(strHtmlCode,"[input]",strTmp)
End Sub
Public Sub AddPwd(strName,strMaxLen,strSize)
Dim strTmp
strTmp = "<input type='password' maxlength=" & strMaxLen
strTmp = strTmp & " size=" & strSize
strTmp = strTmp & " name=" & strName
strTmp = strTmp & " class=" & cssText & " value='[value]'>" & chr(13) & chr(10)
If InStr(strTdValueChk,MUST_FILLED_CHAR) Then
strTmp = strTmp & " <font color=red>*</font>"
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -