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.


 Subscribe in a reader

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

Notices




Closed Thread
 
LinkBack Thread Tools
  #1  
Old Oct 7th, 2004, 03:33
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,612
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!

  #2  
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #3  
Old Oct 7th, 2004, 09:50
Rob's Avatar
Rob Rob is online now
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,189
Blog Entries: 7
Thanks: 27
Thanked 23 Times in 20 Posts
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.
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #4  
Old Oct 7th, 2004, 10:11
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,669
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #5  
Old Oct 7th, 2004, 10:58
Rob's Avatar
Rob Rob is online now
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,189
Blog Entries: 7
Thanks: 27
Thanked 23 Times in 20 Posts
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.
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #6  
Old Oct 7th, 2004, 12:18
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,669
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
don;t u just love vb script?
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #7  
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #8  
Old Oct 7th, 2004, 13:46
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,669
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
u sound like the informer from x-files....
hehe
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #9  
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #10  
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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #11  
Old Oct 7th, 2004, 18:24
Rob's Avatar
Rob Rob is online now
Webforumz Founder
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,189
Blog Entries: 7
Thanks: 27
Thanked 23 Times in 20 Posts
Ok... Are we done here?? lol
__________________
Click the 'Thanks!' button if this post has helped you

Rob - Webforumz Founder
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #12  
Old Oct 9th, 2004, 03:35
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,612
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #13  
Old Oct 9th, 2004, 11:50
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,612
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #14  
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #15  
Old Oct 10th, 2004, 03:02
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,612
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #16  
Old Oct 10th, 2004, 15:43
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 23
Posts: 1,669
Blog Entries: 1
Thanks: 1
Thanked 4 Times in 4 Posts
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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #17  
Old Oct 12th, 2004, 02:48
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,612
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Thanx very much spinal...Your code really makes my day brighter!
God bless...
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
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 21:28.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization 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