Can't Make a Dynamically Built Menu Wrap to 2nd line
Posted: Thu Sep 04, 2008 1:45 am
I am trying to modify a code written by someone else and can't figure it out. The site builds menu buttons based on makes of cars. Client has added more makes and now the menu buttons stretch across on 1 line causing the scrolling. I would like to be able to have the buttons wrap to the next line, based on the browser window size. I've tried modifying the style sheet but with no luck.
The code for the function that creates the buttons is:
<php>function fnMakeButtons()
{
global $oDB;
// 9/26/03 9:18PM
// This is the function that will display distinct Makes at the top of the page
$strSQL = $oDB->executeSQL("select distinct(strMake) as strMake from tblCarList");
$strWidth= 100/mysql_num_rows($strSQL);
?>
<?
while($objMake=mysql_fetch_object($strSQL))
{
?>
<td ><a href="search.php?strMake=<?=$objMake->strMake?>&btnSearch=5" title="Click here to see our <?=$objMake->strMake?> vehicles">
<?=$objMake->strMake?>
</a></td>
<?
}
?>
<?
}
</php>
The page code to where the menu is built is:
<php><table class="TABLEmain" border="0">
<tr>
<td style="width:100%;" colspan="0">
<div id="vehMenu">
<table class="vehMenu">
<tr>
<?fnMakeButtons()?>
</tr>
</table>
</div></td>
</tr>
<tr >
<th style="text-align:center;width:100%;" align="center"> <div style="font-size18px; font-family:Verdana, Arial, Helvetica, sans-serif; color:#000066; ">SEARCH OUR LOT</div>
Click on a vehicle make above to start your search.
<div style="font-size18px; font-family:Verdana, Arial, Helvetica, sans-serif; color:#000066; ">HAVEN'T MADE UP YOUR MIND?</div>
<div id="vehMenu" align="center" style="width:225px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:16px "> <a title="Click Here To View Our Entire Lot" href="type.php">View Our Entire Lot</a> </div>
OR
<div id="vehMenu" align="center" style="width:350px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px ">
<form action="search.php?btnSearch=5" method="post" name="frmStock" id="frmStock" style="text-align:left">
<fieldset>
<legend>Search By Stock Number</legend>
<label for="strStock"> Stock Number:</label>
<input type="text" name="strStock" size="16"/>
<input name="btnSearch" type="submit" onclick="MM_validateForm('strStock','','R');return document.MM_returnValue" value="Search" />
</fieldset>
</form>
</div></th>
</tr>
</table>
</php>
Thanks for your help.
The code for the function that creates the buttons is:
<php>function fnMakeButtons()
{
global $oDB;
// 9/26/03 9:18PM
// This is the function that will display distinct Makes at the top of the page
$strSQL = $oDB->executeSQL("select distinct(strMake) as strMake from tblCarList");
$strWidth= 100/mysql_num_rows($strSQL);
?>
<?
while($objMake=mysql_fetch_object($strSQL))
{
?>
<td ><a href="search.php?strMake=<?=$objMake->strMake?>&btnSearch=5" title="Click here to see our <?=$objMake->strMake?> vehicles">
<?=$objMake->strMake?>
</a></td>
<?
}
?>
<?
}
</php>
The page code to where the menu is built is:
<php><table class="TABLEmain" border="0">
<tr>
<td style="width:100%;" colspan="0">
<div id="vehMenu">
<table class="vehMenu">
<tr>
<?fnMakeButtons()?>
</tr>
</table>
</div></td>
</tr>
<tr >
<th style="text-align:center;width:100%;" align="center"> <div style="font-size18px; font-family:Verdana, Arial, Helvetica, sans-serif; color:#000066; ">SEARCH OUR LOT</div>
Click on a vehicle make above to start your search.
<div style="font-size18px; font-family:Verdana, Arial, Helvetica, sans-serif; color:#000066; ">HAVEN'T MADE UP YOUR MIND?</div>
<div id="vehMenu" align="center" style="width:225px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:16px "> <a title="Click Here To View Our Entire Lot" href="type.php">View Our Entire Lot</a> </div>
OR
<div id="vehMenu" align="center" style="width:350px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px ">
<form action="search.php?btnSearch=5" method="post" name="frmStock" id="frmStock" style="text-align:left">
<fieldset>
<legend>Search By Stock Number</legend>
<label for="strStock"> Stock Number:</label>
<input type="text" name="strStock" size="16"/>
<input name="btnSearch" type="submit" onclick="MM_validateForm('strStock','','R');return document.MM_returnValue" value="Search" />
</fieldset>
</form>
</div></th>
</tr>
</table>
</php>
Thanks for your help.