table color?

This is a discussion on "table color?" within the Classic ASP section. This forum, and the thread "table color? are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Oct 7th, 2004, 03:33
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
table color?

I WAS WONDERING HOW TO MAKE MY TABLE(ROW) COLOR TO BE SAME LIKE WEBFORUMZ DOES?

WHAT I HAVE IN MY ASP PAGE RIGHT NOW IS JUST ONE COLOR WHEN I TRIED TO DISPLAY ALL MY DATA IN THE DATABASE USING "REPEAT REGION".

WHAT I WANT TO DO IS TO DISPLAY FIRST ROW AS <span style="color:blue">BLUE </span id="blue"> COLOR, AND THE NEXT ROW WILL BE WHITE COLOR, THE THIRD WILL BE <span style="color:blue">BLUE </span id="blue"> AGAIN...AND SO ON...

JUST WONDERING...
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)

  #2 (permalink)  
Old Oct 7th, 2004, 08:21
Reputable Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 341
Thanks: 0
Thanked 0 Times in 0 Posts
just use a variable inside the loop that ceates each row;

Code: Select all
Dim rowcolor : rowcolor = "blue" 'set this as the second row color
for iLoop = 0 to x
    if rowcolor = "white" then
        rowcolor = "blue"
    else
       rowcolor = "white"
    end if
    response.write "<tr background="<% rowcolor %>"><td>[row contents]</td></tr>"
next
  #3 (permalink)  
Old Oct 7th, 2004, 09:50
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
Or you could use:-
Code: Select all
Dim rowcolor : rowcolor = "blue" 'set this as the second row color
for iLoop = 0 to x
    rowcolor = "white"
    if iLoop MOD 2 = 1 then rowcolor="blue"
    response.write "<tr background="<% rowcolor %>"><td>[row contents]</td></tr>"
next
Same thing.... just shorter.
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
  #4 (permalink)  
Old Oct 7th, 2004, 10:11
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
or maybe...
Code: Select all
Class Zebras
 Private RowCount

 Public Property Get Colour()
  If (RowCount MOD 2)=0 Then Colour= "black" Else Colour= "white"
  RowCount = RowCount + 1
 End Property
End Class

Dim MyRows = New Zebras
Do While Not rs.EOF
  Response.Write "<tr style='background-color:" & MyRows.Colour & "'>stuff</tr>" & vbCRLf
Loop

just thought I'd join the party...
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
  #5 (permalink)  
Old Oct 7th, 2004, 10:58
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
Thats actually what I do Spinal!

I'll point out though, that unless you are using this on a site-wide level, it's not really worth it.
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
  #6 (permalink)  
Old Oct 7th, 2004, 12:18
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
don;t u just love vb script?
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
  #7 (permalink)  
Old Oct 7th, 2004, 12:58
Reputable Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 341
Thanks: 0
Thanked 0 Times in 0 Posts
rumour is that CSS3 will support this kind of thing with a 'count' function
  #8 (permalink)  
Old Oct 7th, 2004, 13:46
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
u sound like the informer from x-files....
hehe
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
  #9 (permalink)  
Old Oct 7th, 2004, 15:19
Highly Reputable Member
Join Date: Jul 2003
Location: Ipswich, UK
Posts: 690
Thanks: 0
Thanked 0 Times in 0 Posts
  #10 (permalink)  
Old Oct 7th, 2004, 16:30
Reputable Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 341
Thanks: 0
Thanked 0 Times in 0 Posts
isn't the informer this guy?
  #11 (permalink)  
Old Oct 7th, 2004, 18:24
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
Ok... Are we done here?? lol
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
  #12 (permalink)  
Old Oct 9th, 2004, 03:35
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
hey thanx guys, let me try them first!

Errrmmm...Rob, did you forgot something
You promise to help me about the ASP TO WORD thing...

ASP to MS Word
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
  #13 (permalink)  
Old Oct 9th, 2004, 11:50
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Well guys...I am a bit confuse here
Actually my looping method that i used for my ROW Table seems different from the method that you guys used
Acually, this is the code that the software automatically coded for me(macromedia ultradev),
I have just to click, click and click... They have all this basic function built in...
I have learn lots of them especially modifying existing code from WEBFORUMZ

I have a hard time to modify the code that you guys gave me...
This is the code that i used. It have 1 row and 3 column..(initially)

Can you guys show me where should I add the code for the row looping color?

<span style="color:blue">This is my LOOPING method!</span id="blue">
Code: Select all
<% 
   While ((Repeat2__numRows <> 0) AND (NOT allComment.EOF))
%>
    
<tr> 
  <td class=bodytext width="18%" height="50" valign="top" bordercolorlight="#000000" bordercolordark="#000000" bgcolor="#FFFFFF">
    	<font face="Verdana" style="font-size: 8pt" color="#004685"><%=(allComment.Fields.Item("cName").Value)%></font>

        <font face="Verdana" style="font-size: 8pt"><%=(allComment.Fields.Item("cDate").Value)%></font>

  </td>
  <td class=bodytext width="73%" height="50" valign="top" bordercolorlight="#000000" bordercolordark="#000000" bgcolor="#FFFFFF">
      	<font face="Verdana" style="font-size: 8pt"><%=(allComment.Fields.Item("cComment").Value)%></font>
  </td>
  <td width="9%" height="50" bordercolorlight="#000000" bordercolordark="#000000" bgcolor="#FFFFFF"> 
        <p align="center"><font face="Verdana" style="font-size: 8pt">Delete</font>
  </td>
</tr>

<% 
   Repeat2__index=Repeat2__index+1
   Repeat2__numRows=Repeat2__numRows-1
   allComment.MoveNext()
   Wend
%>
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
  #14 (permalink)  
Old Oct 9th, 2004, 12:15
Reputable Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 341
Thanks: 0
Thanked 0 Times in 0 Posts
The looping starts with WHILE and ends with WEND.
  #15 (permalink)  
Old Oct 10th, 2004, 03:02
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Well guys...
I tried to put the variable inside my looping code but it cannot work.
Should i write the Response.write before my <tr>??

Can anybody help me or show me how to modify my code please
Guide me perhaps...I really need this code to work on my page!
Rob, Spinal...?Help me please

Thanx Guys
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
  #16 (permalink)  
Old Oct 10th, 2004, 15:43
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
the easy way:
Code: Select all
<% 
  RowCount = 0
   While ((Repeat2__numRows <> 0) AND (NOT allComment.EOF))
    If (RowCount Mod 2)=0 Then RowColour = "#DEDEDE" Else RowColour = "#CDCDCD" 
    RowCount = RowCount + 1
%>
    
<tr style="background-color:<%=RowColour%>"> 
  <td class=bodytext width="18%" height="50" valign="top" bordercolorlight="#000000" bordercolordark="#000000" bgcolor="#FFFFFF">
        <font face="Verdana" style="font-size: 8pt" color="#004685"><%=(allComment.Fields.Item("cName").Value)%></font>

        <font face="Verdana" style="font-size: 8pt"><%=(allComment.Fields.Item("cDate").Value)%></font>

  </td>
  <td class=bodytext width="73%" height="50" valign="top" bordercolorlight="#000000" bordercolordark="#000000" bgcolor="#FFFFFF">
          <font face="Verdana" style="font-size: 8pt"><%=(allComment.Fields.Item("cComment").Value)%></font>
  </td>
  <td width="9%" height="50" bordercolorlight="#000000" bordercolordark="#000000" bgcolor="#FFFFFF"> 
        <p align="center"><font face="Verdana" style="font-size: 8pt">Delete</font>
  </td>
</tr>

<% 
   Repeat2__index=Repeat2__index+1
   Repeat2__numRows=Repeat2__numRows-1
   allComment.MoveNext()
   Wend
%>
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
  #17 (permalink)  
Old Oct 12th, 2004, 02:48
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Thanx very much spinal...Your code really makes my day brighter!
God bless...
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Closed Thread

Tags
table, color

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
background-color kapyrossi Web Page Design 5 Jul 4th, 2007 15:53
link color somsahi Web Page Design 3 Aug 25th, 2006 17:02
Need to align width of Float table with the table below Vertabase Web Page Design 4 Mar 8th, 2006 21:21
background color kaz Web Page Design 4 Aug 4th, 2005 17:28
background color kaz Web Page Design 1 Apr 20th, 2005 11:43


All times are GMT. The time now is 06:22.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43