Jump to content


Photo

Help! Alternating row colors look great in Firefox, don't work in IE.


  • Please log in to reply
5 replies to this topic

#1 ridiculous

ridiculous
  • Members
  • PipPipPip
  • Advanced Member
  • 175 posts

Posted 07 October 2006 - 06:32 AM

Here's my code:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Thrills.</title>

<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />

<style type="text/css">
body {
	font-size: 12px;
	font-family: arial, helvetica, sans-serif;
	color: #333;
}


#trentdiv {
	position:absolute;
	top: 50%;
	left: 50%;
	width:520px;
	height:300px;
	margin-top: -150px; /*set to a negative number 1/2 of your height*/
	margin-left: -255px; /*set to a negative number 1/2 of your width*/
	border: 5px solid #ccc;
	background-color: #f3f3f3;
	overflow:auto;
}

</style>

<?
// Connects to your Database 
mysql_connect("", "", "") or die(mysql_error()); 
mysql_select_db("") or die(mysql_error()); 


$jobs = mysql_query("SELECT date, title, location FROM jobs
ORDER BY `postid` DESC LIMIT 0 , 30") 
or die (mysql_error());

$numofrows = mysql_num_rows($jobs);



echo "<div id='trentdiv'>";
echo "<table width='500 px' height= '400 px' align = 'center' 
border='1' cellpadding='3' cellspacing='3'>";


for($i = 0; $i < $numofrows; $i++) {
   
    $row = mysql_fetch_array($jobs); //get a row from our result set
    if($i % 2) { //this means if there is a remainder
    
	echo "<tr bgcolor='#ddd8dc'";
    
	} else { 
	
	echo "<tr bgcolor='#feaae9'>";
    }
    
	echo 	"
			<td align=left> 	".$row['date']."		</td>
			<td align=center><b>".$row['title']."	</b>	</td>
			<td align=center>	".$row['location']."	</td>";  
    echo "</tr>";
}



echo "</TABLE>";
echo "</div>";

?>






Any insight would be muchly appreciated, here's a couple of jpegs that demonstrate what I'm talking about...

Posted Image

Posted Image



#2 alpine

alpine
  • Members
  • PipPipPip
  • Advanced Member
  • 756 posts
  • LocationNorway

Posted 07 October 2006 - 06:41 AM

You have a misplaced tr close, probably that one messing up:

echo "<table width='500 px' height= '400 px' align = 'center' border='1' cellpadding='3' cellspacing='3'> </tr>";


**EDIT**

Noticed another one - missing close bracket on one of your tr starts

echo "<tr bgcolor='#ddd8dc'>";

} else {

echo "<tr bgcolor='#feaae9'>";

#3 ridiculous

ridiculous
  • Members
  • PipPipPip
  • Advanced Member
  • 175 posts

Posted 07 October 2006 - 06:58 AM

I wish that </tr> would have done the trick. No go. Thanks, I'm still looking.

#4 alpine

alpine
  • Members
  • PipPipPip
  • Advanced Member
  • 756 posts
  • LocationNorway

Posted 07 October 2006 - 07:00 AM

I think you missed my EDIT, look again

#5 ridiculous

ridiculous
  • Members
  • PipPipPip
  • Advanced Member
  • 175 posts

Posted 07 October 2006 - 07:02 AM

Thank you so very, very much. I really appreciate it. If there's anything I can do for you, let me know.

#6 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 07 October 2006 - 02:12 PM


As your using css you goto use the color: red; property and the background-color propery together.

as you see from the code below as it is fully valadated as correct with no warnings form

http://jigsaw.w3.org/css-validator/

please always valadate your css code and your html.


<style type="text/css">
body {
	font-size: 12px;
	font-family: arial, helvetica, sans-serif;
	color: #333;
            background-color: #f3f3f3;
}


#trentdiv {
	position:absolute;
             color: red;
	top: 50%;
	left: 50%;
	width:520px;
	height:300px;
	margin-top: -150px; /*set to a negative number 1/2 of your height*/
	margin-left: -255px; /*set to a negative number 1/2 of your width*/
	border: 5px solid #ccc;
	background-color: #f3f3f3;
	overflow:auto;
}

</style>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users