Color. asp
Author: Tao Internet
Source: Taotao
Note: Please indicate the source for reprinting.
<%
Const adInteger = 3
Const adVarChar = 200
'Declare variables
Dim myRecordset
Dim iLetter
Dim Field
Dim strAltColor
Dim bColor
BColor = False
'This example uses the recordset in memory. All you need to do is modify the display part of your data.
Set myRecordset = Server. CreateObject ("ADODB. Recordset ")
MyRecordset. Fields. Append "ID", adInteger
MyRecordset. Fields. Append "Title", adVarChar, 25
MyRecordset. Fields. Append "Description", adVarChar, 255
MyRecordset. Open
'Fill RS with sample data:
For iLetter = Asc ("A") To Asc ("M ")
MyRecordset. AddNew
MyRecordset. Fields ("ID"). Value = iLetter-64
MyRecordset. Fields ("Title"). Value = "letter:" & Chr (iLetter)
MyRecordset. Fields ("Description"). Value = "test letter:" & Chr (iLetter )&"."
MyRecordset. Update
Next 'letter
'Move to the start position of the header to start the following loop.
MyRecordset. MoveFirst
'Show data in the table
Response. Write "<table border =" "0" "cellspacing =" "0" "cellpadding =" 3 ">" & vbCrLf
'Header
Response. Write vbTab & "<tr>" & vbCrLf
For Each Field in myRecordset. Fields
Response. Write vbTab & "<td bgcolor =" "# CCCCCC" "> <strong>"
Response. Write Field. Name
Response. Write "</strong> </td>" & vbCrLf
Next 'field
Response. Write vbTab & "</tr>" & vbCrLf
Do While Not myRecordset. EOF
'Cycle to change the background color of the cell
BColor = Not bColor
If bColor Then
StrAltColor = "# FFFFFF"
Else
StrAltColor = "# FF8040"
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.