...

View Full Version : CSS and PHP, begginer problems



kajzec
01-05-2012, 04:48 PM
Here is my code:

<html>
<head>
<title>Prva</title>
<style type="text/css">
table
{
border=5px;
height=50px;
witdh=50px;
}
td.izbrana
{
background=green;
}
</style>
</head>
<body>

<?php
$N=3;
$zaporedna=0;

echo "<table>";
for($i=1; $i<=$N; $i++)
{
echo"<tr>";
for($j=1; $j<=$N; $j++)
{
$zaporedna++;
$izbrana=rand(1,5);
$string_izbrana="izbrana";

if($izbrana==5)
{
echo"<td class=$string_izbrana> $zaporedna";
}
else
{
echo"<td> $zaporedna";
}
}
echo"</tr>";
}
echo "</table>";
?>

</body>
</html>

I am trying to use the izbrana class every time the random is equal to 5.
It just doesn't work.
I am trying to achieve something like this
http://uss.feri.uni-mb.si/images/Vaje/vaja12/naloga3b.gif,
but I don't, it seems like the css isn't in use.

tracknut
01-05-2012, 05:11 PM
CSS uses colons, not equals signs, between the attribute and value, like this:
table {border:5px}

You also need a doctype on your html.

Dave

kajzec
01-05-2012, 06:03 PM
Oh, how could I be that blind. Thank you very much!
Can someone describe me how do I get the time elapsed between the table creation and the click of the button?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum