Home > Backend Development > PHP Tutorial > 表格颜色问题。新手

表格颜色问题。新手

WBOY
Release: 2016-06-23 14:00:40
Original
979 people have browsed it

这是我刚打的代码,原本想是一行黄色一行无色,可不知怎么回事变成全黄的了,大家帮我看看

<table border="1"><?phpfor($i=1; $i<=9; $i++){	for($n=1; $n<9; $n++)	{		if($n%2==0)		{			echo '<tr bgcolor="yellow">';		}		else		{			echo '</tr>';		}	}	for($j=1; $j<=$i; $j++)	{		$c = $i * $j;		echo "<td>".$j."*".$i."=".($i*$j)." <tt>"."<td>" ; 	}	echo "<br>";}?>
Copy after login


回复讨论(解决方案)

<html><body>	<table border="1">		<?php		for($i=1; $i<=9; $i++)		{						if($i%2==0)			{				echo '<tr bgcolor="yellow">';			}			else			{				echo '</tr>';			}						for($j=1; $j<=$i; $j++)			{				$c = $i * $j;				echo "<td>".$j."*".$i."=".($i*$j)." <tt>"."<td>" ; 			}			echo "<br>";		}		?>	</table></body></html>
Copy after login
Copy after login

<html><body>	<table border="1">		<?php		for($i=1; $i<=9; $i++)		{						if($i%2==0)			{				echo '<tr bgcolor="yellow">';			}			else			{				echo '</tr>';			}						for($j=1; $j<=$i; $j++)			{				$c = $i * $j;				echo "<td>".$j."*".$i."=".($i*$j)." <tt>"."<td>" ; 			}			echo "<br>";		}		?>	</table></body></html>
Copy after login
Copy after login


谢谢
<table border="1"><?phpfor($i=1; $i<=9; $i++){        if($i%2!=0)        {            echo '<tr bgcolor="yellow">';        }        else        {            echo '<tr>';        }    for($j=1; $j<=$i; $j++)    {        echo "<td>".$j."*".$i."=".($i*$j)." <tt>"."</td>";     }	echo "</tr>";    echo "<br>";}?></table>
Copy after login


这是现在的代码 不明白为什么在浏览器上会空出一大块地方来?

echo "
";造成的 吧这个去掉

标记不配套

echo '<table border="1">';for($i=1; $i<=9; $i++) {    for($n=1; $n<9; $n++){        if($i%2==0) {            echo '<tr bgcolor="yellow">';        }else {            echo '<tr>';        }    }    for($j=1; $j<=$i; $j++) {        $c = $i * $j;        echo "<td>".$j."*".$i."=".($i*$j)." </td>" ;     }    echo "</tr>";}echo '</table>';
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template