Samurai Legend Posted March 19, 2016 Share Posted March 19, 2016 Hello, where there player advertisements are. I want a scroll bar to be there instead of the page just expanding. <?php require('globals.php'); echo "<h3><u>Newspaper</u></h3>"; if(!isset($_GET['action'])) $_GET['action'] = ''; switch($_GET['action']) { case 'add': addPage($db, $ir); break; case 'delete': deletePage($db, $ir); break; default: index($db, $ir, $sa); break; } function index($db, $ir, $sa) { $q = $db->query("SELECT `content` FROM `papercontent` LIMIT 1"); $content= $db->fetch_single($q, 0, 0); ?><hr width='95%'> <table width = '95%' cellspacing = '1' class='table'> <tr> <td><a href='job.php'>Your Job</a></td> <td><a href='gym.php'>Local Gym</a></td> <td><a href='halloffame.php'>Hall Of Fame</a></td> <td><a href='clancentral.php'>Clans</a></td> <td><a href='brothel.php'>Brothel</a></td> </tr> <tr> <td><a href='userlist.php'>Local Residents</a></td> <td><a href='stats.php'>City Stats</a></td> <td><a href='usersonline.php'>Users Online</a></td> <td><a href='clanwars.php'>Current Wars</a></td> <td><a href='estate.php'>Estate</a></td> </tr></table><hr width='95%'> <table width = '95%' cellspacing = '1' class='scroll'> <tr> <th colspan = '5'>Player Advertisements | <a href='newspaper.php?action=add'><b>Buy An Advertisement (¥10,000)</b></a><?php echo in_array($ir['user_level'], [2, 3]) ? " | <a href=newspaper.php?action=all><b>[DELETE ALL]</b></a>" : ''; ?></th></tr> <tr> <td colspan = '5'> <?php $anpdata = $db->query("SELECT * FROM `news_paper` ORDER BY `npTIME` DESC"); if(!$db->num_rows($anpdata)) echo "<hr/>Only ¥10,000!</b> - Create an advertisement for ¥10,000."; else while($npdata = $db->fetch_row($anpdata)) { $time = date('F j',$npdata['npTIME']); echo "<hr/><p align = 'left'><b>Ad By: <a href='viewuser.php?u={$npdata['npADDER']}'><font color = 'white'>" . $sa->username($npdata['npADDER']) . "</font> [{$npdata['npADDER']}]</a> | Added On: {$time}</b>"; echo in_array($ir['user_level'], [2, 3]) ? " | <a href=newspaper.php?action=npID&npID={$npdata['npID']}><b>[DELETE]</b></a>" : ''; echo "<br/><b><u>{$npdata['npTITLE']}</u></b></p> <p align = 'left'>{$npdata['npBODY']}</p>"; } ?><hr/></table><hr width = '95%'><table width = '95%' cellspacing = '1' class = 'table'><tr> <th>Game News</th></tr><tr><td><div style='text-align: left; padding-left: 5px;'><?php echo $content;?></div></td></tr></table><hr width='95%'><a href = 'index.php'>>Go Home</a><hr width='95%'><?php } I tried classing the table in css to add the scroll bar. However, it is not working. I also used div and p to class out the css however, it is still not working. .scrollit { overflow:scroll; height:100px; } Quote Link to comment Share on other sites More sharing options...
Djkanna Posted March 19, 2016 Share Posted March 19, 2016 How do you want it to scroll? Leave the headings at the top and just scroll on the rows, or do you want the entire table to scroll? Try this either way. Quote Link to comment Share on other sites More sharing options...
Coly010 Posted March 20, 2016 Share Posted March 20, 2016 Simple and basic solution: style='overflow-y:auto;' Put it within table element. Quote Link to comment Share on other sites More sharing options...
Dayo Posted March 20, 2016 Share Posted March 20, 2016 you cant do overflow-y: scroll within a table as this can only be used with a block element there are jquery plugins like http://www.farinspace.com/jquery-scrollable-table-plugin/ that will split the headers/body/footer up into seperate elements and wrap the tbody into a div that scrolls Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.