我是php的新手,我正在尝试研究如何设计网页,该代码不是我的。我的问题是,我使用表格完成了一些可点击的操作,因为我有一个数组
$buttons=array('Home'=>'home.php',
'Contact'=>'contact.php',
'Services'=>'service.php',
'Site map'=> 'map.php');
有一个功能
function DisplayMenu($buttons)
{
echo "<table width='100%' bgcolor
='white' cellpadding='4'
cellspacing='4'\n";
echo "<tr>\n";
$width =100/count($buttons);
while (list($name, $url)=each ($buttons))
{
$this-> DisplayButton($width, $name,
$url);
}
echo "</tr>\n";
echo "</table>\n";
}
还有用于显示按钮的功能
function DisplayButton($width, $name, $url)
{
echo " <td width='$width%'>
<a herf ='".$url."'>
<img src= 'ab.jpg' alt='$name'
border='0'>
</a> <a herf='".$url."'><span
class ='menu'>
".$name."</span></a></td>";
}
我的问题是,例如当我单击主页按钮时,它没有将我带到home.php页面,有人可以帮助我吗?
答案 0 :(得分:-1)
只是一个错字(从href转换为href)
function DisplayButton($width, $name, $url)
{
echo "
<td width='{$width}%'>
<a href='{$url}'>
<img src='ab.jpg' alt='{$name}' border='0'>
</a>
<a href='{$url}'>
<span class='menu'>{$name}</span>
</a>
</td>
";
}