HTML - Html Table Row Alternate Color
I had the following code,how can I make alternate color for each row?Actually I retrieved the data from database and bind to table,so I do not know the total number of row.How to make alternate color??
Code: Private Sub TableDetails(ByVal MydinProdNbr As String, ByVal OldStockCode As String, ByVal SupplierPrdNbr As String, ByVal Description As String, ByVal Packing As String, ByVal ListPrice As String, ByVal Disc1 As String, ByVal Disc2 As String, ByVal Disc3 As String, ByVal TotalOrderQty As String, ByVal DeliveredQty As String, ByVal SelectedQty As String, ByVal FOCQty As String, ByVal DiscountAmt As String, ByVal NetUnitPrice As String, ByVal Amount As String) lbl.Text = lbl.Text & "<tr bgcolor=#99CCFF>" lbl.Text = lbl.Text & "<td style=""font-size: 7pt"" width=""63pt"">" lbl.Text = lbl.Text & MydinProdNbr lbl.Text = lbl.Text & "</td>" lbl.Text = lbl.Text & "<td style=""font-size: 7pt"" width=""60pt"">" lbl.Text = lbl.Text & OldStockCode lbl.Text = lbl.Text & "</td>" lbl.Text = lbl.Text & "<td style=""font-size: 7pt"" width=""62pt"">" lbl.Text = lbl.Text & SupplierPrdNbr lbl.Text = lbl.Text & "</td>" lbl.Text = lbl.Text & "<td style=""font-size: 7pt"" width=""180pt"">" lbl.Text = lbl.Text & Description lbl.Text = lbl.Text & "</td>" lbl.Text = lbl.Text & "<td style=""font-size: 7pt"" width=""56pt"">" lbl.Text = lbl.Text & Packing lbl.Text = lbl.Text & "</td>" lbl.Text = lbl.Text & "<td style=""font-size: 7pt"" width=""64pt"">" lbl.Text = lbl.Text & ListPrice lbl.Text = lbl.Text & "</td>" lbl.Text = lbl.Text & "<td style=""font-size: 7pt"" width=""49pt"">" lbl.Text = lbl.Text & Disc1 lbl.Text = lbl.Text & "</td>" lbl.Text = lbl.Text & "<td style=""font-size: 7pt"" width=""49pt"">" lbl.Text = lbl.Text & Disc2 lbl.Text = lbl.Text & "</td>" lbl.Text = lbl.Text & "<td style=""font-size: 7pt"" width=""49pt"">" lbl.Text = lbl.Text & Disc3 lbl.Text = lbl.Text & "</td>" lbl.Text = lbl.Text & "<td style=""font-size: 7pt"" width=""49pt"">" lbl.Text = lbl.Text & TotalOrderQty lbl.Text = lbl.Text & "</td>" lbl.Text = lbl.Text & "<td style=""font-size: 7pt"" width=""49pt"">" lbl.Text = lbl.Text & FOCQty lbl.Text = lbl.Text & "</td>" lbl.Text = lbl.Text & "<td style=""font-size: 7pt"" width=""67pt"">" lbl.Text = lbl.Text & DiscountAmt lbl.Text = lbl.Text & "</td>" lbl.Text = lbl.Text & "<td style=""font-size: 7pt"" width=""49pt"">" lbl.Text = lbl.Text & NetUnitPrice lbl.Text = lbl.Text & "</td>" lbl.Text = lbl.Text & "<td style=""font-size: 7pt"" width=""60pt"">" lbl.Text = lbl.Text & Amount lbl.Text = lbl.Text & "</td>" lbl.Text = lbl.Text & "</tr>" End Sub Similar TutorialsBasically I'm not wanting to change my established code too much just yet and I want to know if there's some script way to detect someone's browser and then use a different .css file for each type of browser I want to set it up for. I know pretty much how to detect the browser type but not so much how to do the <link href= part so that it would work in the script. Anyone have a suggestion?... Codeguru PS- I know I can just made an index.html that links over to a different page for each and every browser but that is really not an option with the amount of time it takes to update the page every day. my site at http://www.freewebs.com/fallingrain11/1.html im trying to get all the tables the same color but i cant get the last bit of it to color for me the line of code that makes that part of the table i think is ... <td align="left" Width="17%" valign="top" tr> i tried setting the color in .td2{} and tried to call it <td class=td2; ... .... .....> How/where can I add a background color to this table? thanks. Code: <TABLE cellSpacing=0 cellPadding=0 width=100% border=0> <TR> <TD><font class=tbody> <form action="/smusermanager/members/default.asp?action=login" method=post name=login language="JAVASCRIPT" onsubmit="return Validate();"><input type=hidden name=todo value="login"><input type=hidden name=url value="/smusermanager/members/default.asp"> <table border=0 cellspacing=0 cellpadding=0 width=95% align=center class=colorformborder><tr class=colorformborder><td><table border=0 cellspacing=0 width=100% cellpadding=0><tr class=colorformborder><td colspan=2><table border=0 cellspacing=1 cellpadding=5 width=100% colspan=2><tr class=colorformheader><td colspan=2><font class=textsize9><font color=white><b>Login Here</b></font></td></tr> <tr class=colorformfields><td align=center colspan=2><font class=textsize9></font></td></tr><tr class=colorformfieldsalt><td align=right width=50% ><font class=textsize9>Email Address</font></td><td><font class=textsize9><input class=fieldbox type=text size=20 maxlength=50 name="members_username"></font></td></tr> <tr class=colorformfields><td align=right width=20% ><font class=textsize9>Password</font></td><td><font class=textsize9><input class=fieldbox type=password size=20 maxlength=50 name="members_password"></font></td></tr><tr class=colorformfields><td colspan=2 align=right><font class=textsize9><input class=fieldbox type=submit value="Login" id=submit2 name=submit2></font></td></tr> </td></tr></table></td></tr></table></td></tr></table></form> <div style="padding-left: 24px;"> <font face="Arial" color="#000000" size="3"><img src="/images/Hphone.gif" style="vertical-align: middle;"> <a href="?action=login"> Home</a><br><br> <IMG src="/images/clear.gif" width=1 height=5><br><img src="/images/hphone1.gif" style="vertical-align: middle;"><a href="?action=register"> Register</a><br><br> <IMG src="/images/clear.gif" width=1 height=5><br><img src="/images/hphone2.gif" style="vertical-align: middle;"><a href="?action=forgotusername"> FAQ</a><br><br> <IMG src="/images/clear.gif" width=1 height=5><br><img src="/images/hphone3.gif" style="vertical-align: middle;"><a href="?action=forgotusername"> Terms Of Use</a><br><br> <IMG src="/images/clear.gif" width=1 height=5><br><img src="/images/hphone4.gif" hspace="4px" style="vertical-align: middle;"> <a href="?action=forgotusername"> Contact Us</a><br><br> <IMG src="/images/clear.gif" width=1 height=5><br><img src="/images/hphone5.gif" style="vertical-align: middle;"><a href="?action=forgotpass"> Forgot Password</a><br><br> <IMG src="/images/clear.gif" width=1 height=5><br><img src="/images/hphone7.gif" style="vertical-align: middle;"><a href="?action=forgotusername"> Forgot Username</a></font></div> </font> </TD> </TR> </TABLE> pretty much a beginner with html, have a basic site up. i did some stuff with <tr> and <td> and got different columns. thing is i want the columns to have different colors but it is not working. if i add bg=lightblue inside a table (no i dont intend to mix orange and lightblue later on) it all gets lightblue. <html> <body bgcolor="orange"> <table border="0" width="100%" cellpadding="10"> <td width="20%" valign="top"> <p> <b>Index</b> </p> <p> <a href="/signup">Click here to signup</a> </p> <p> <a href="/download">Download the games</a> </p> <p> <a href="/play">Play a game</a> </p> <b>This site is powered by:</b> <p> <a href="http://python.org">python</a> </p> <p> <a href="http://webpy.org">web.py</a> </p> </td> <td width="60%" valign="top"> <b>Welcome</b> </td> <td width="20%" valign="top"> <b>last column</b> </td> </table> </body> </html> My tables background color (done with dreamweaver) isn't showing correctly in Firefox. but is in internet explorer. Code: <td colspan="2" rowspan="4" bgcolor="de8801">TEXT</td> is the code I'm using to define the background color? Can anyone help?! Anders Hi, I need some code that will make cells in a table change colour (yellow) with mouse over. The problem is that i really need to avoid having to put the code in <TD> as there are about 5000 cells in total! and that will add alot of bytes to it. Needs to work in IE7 and firefox mainly. Any help would be great! Thanks Joe Is there a simple attribute for tables that tells it to alternate the colors for every second row? For example, if I want to create a table where the first row background color is grey, the second row is white, the third grey, the fourth white, and so on, is there a simple attribute like "altcolor=grey" or something like that (maybe in CSS)? Hi, I need to write text in different colors in the cells of a table... for now i use <FONT> but since it is deprecated how can i do this without FONT? HTML Code: <TABLE> <TR> <TD><FONT COLOR=BLUE>BLUE</FONT></TD> <TD><FONT COLOR=RED>RED</FONT></TD> <TR> <TD><FONT COLOR=BLACK>BLACK</FONT></TD> <TD><FONT COLOR=YELLOW>YELLOW</FONT></TD> </TABLE> I am working on a site that I have designed using a table to lay everything out. Everything works fine when viewing via IE. I tried opening it with Firefox and the backround colors for the different cells did not show up. Can anyone tell me what I should do so that the bgcolor shows up correctly in firefox? temp web-site address: http://worldcargousa.com/estate_lawn part of the html in question: <td width="166" align="center" valign="middle" bgcolor="61592b"><p align="center" class="style9"><span class="style15">715-220-1879 </span></p> <p class="style13">Estate Lawn Services<br> 536 Gentalwood Square<br> Purcellville, VA 20132</p> <p align="left" class="style8"> </p></td> So I decided to see if I could make my site XHTML 1.0 Strict-compliant. Here's the main page on my test server I'd be thrilled with it if I could do 3 things: - Set the background color of the left column to match the color behind the fonts. Is there a CSS class I can create and set the cells to that class? - Remove the border around clickable images. - Get the spacing between the menu options on the left to look the way it does on the other pages in the site. If you click any of the pages on my actual site you can see the look I'm going for. Thanks as always for the help! Joshua Hi, I need to convert a java application into a web servlet, and I was having troubles building the UI in HTML. Basically, I need 3 sliders, red, green, and blue, on a table, that adjust the color of a separate cell in the table. How complicated would it be to do this? I'm fairly new to HTML. If there is any easier way to implement this without sliders, that would be great too. Hi, Quick question from a newb: I'm trying to change the color of the scrollbar on my page from the standard gray to black/red to match the layout of my page, with overflow set to auto. Is there any simple HTML code to do this, without having to use CSS? For instance, something like <scrollbarcolor="black"> or something easy like that? Sorry for the simple question. I've googled it, but haven't been able to find a clear answer. Thanks in advance! i wanted to change the color of the outside blue caused by the hyperlink and i am having trouble. i wanted it to be only for THIS and not the rest of the page. thank you in advance! <img src="http://i702.photobucket.com/albums/ww26/Fine-TuneXP/navbarfullcopy.jpg" class="greenlink" width="804" height="15" usemap="#planetmap"> <map id="planetmap" name="planetmap"> <area shape="rect" coords="0,0,50,28" alt="Home" href="http://fine-tunexp.webs.com/index.htm" class="greenlink"> <area shape="rect" coords="56,0,147,28" alt="Downloads" href="http://fine-tunexp.webs.com/Downloads.htm" class="greenlink"> <area shape="rect" coords="155,0,217,28" alt="Venus" href="http://fine-tunexp.webs.com/Tweaks.htm" class="greenlink"> <area shape="rect" coords="225,0,360,28" alt="Venus" href="http://fine-tunexp.webs.com/requests.htm" class="greenlink"> </map> EDIT: i was looking around and i saw something interesting, i cant figure out how to use it in my code but, <style type="text/css"> a:link { color:#f00; } #footerlink { color:#000; } </style> GIven the code snippet I want to color all the elements of column 3 with green..is there a command for this.??? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <table align="left" width="100%" border="1"> <tr> <th rowspan="2" height="30">ID Number</th> <th rowspan="2" height="30">Name</th> <th rowspan="2" height="30" bgcolor="#00FFCC">Date of Birth</th> <th colspan="2" height="15" align="center">Qualification</th> </tr> <tr> <th height="15">Educational</th> <th height="15">Professional</th> </tr> <tr> <td>1.</td> <td>a.</td> <td>12/12/1979</td> <td>graduate</td> <td>engineering</td> </tr> <tr> <td>2.</td> <td>b.</td> <td>13/1/1969</td> <td>post graduate</td> <td>engineering</td> </tr> <tr> <td>3.</td> <td>c.</td> <td>10/1/1969</td> <td>PHD </td> <td>Sc</td> </tr> </table> </body> </html> Hello im new here its good to be here I need your help! I am now learning HTML because i realised how important it is...and im stuck in this thing PHP Code: var alternateContent = 'Welcome to mywebsite' + 'Please download Flash Player to view content.' + '<a href="http://www.adobe.com/go/getflashplayer/">Download Flash</a>'; document.write(alternateContent); // insert non-flash content } // --> </script> <img src="Html_logo.jpg" alt="" width="273" height="46" longdesc="http://Html_logo.jpg" /> </body> </html> this is part of the code ...didnt post it all since it was too much... What i need to do is to color the text yellow "Welcome to my website . Please download Flash Player to view content" I tried <FONT COLOR = "######"> but didnt work... Also how do i add the HTML_logo Above the text ..? Any ideas? Hi guys, I need a help from you guys. I'm having some html pages, and i want to give the option to change the background and font color in the html pages by clicking buttons. And that setting should be saved in the user system, when the user loads the page again in the system, that the page should load with the saved settings. I don't want to go for server side scriptings. Is it possible just in html and Java script. Can you guys help me in this. Thanks in Advanse Kumar First off I want to say that I'm new to this forum. Thanks in advance for the help you can give to a noobie. Here's the "dummy page" I put up: http://www.mrcrepe.com/work.html The table I made in dreamweaver. I put it as 900px wide with 1 row and 2 columns. The border color I made a redish/pinkish color as you can see on the outsides, but how do I make that "separater border" into the same color? Right now it's just that silver line. Thanks in advance. -Brian Hi, My webpage has several elements of the same name. How do I access all of them one by one? Hi, I want to change the background color of my textbox on focus and change it back to white on onblur event. Issue: When i change the back ground color for text box on focus it properly changes it. But when i leave the focus from textbox border color for text box is impacted and its changed to white. Please help so that border color for textbox is not impacted only background color should change here is the sample code <code> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <p> <input name="text1" type="text" id="text1" value="textbox 1" onfocus="this.style.background ='#cad5df'" onblur="this.style.background='white'"> </p> <p> <input name="text2" type="text" id="text2" value="textbox 2" onFocus="this.style.background = 'yellow'" onBlur="this.style.background='white'"> </p> </body> </html> </code> |