mysql テーブルの内容を含む DIV を含む php ファイルがあります。このページには他のリンクと情報もあります。
div コンテンツのみにスクロールバーを設定したいので、overflow=scroll; を使用しました。スクロールバーはDIVでは機能しません。
助けが必要 !
これが私のコードです:
<html>
<head>
<title></title>
<style type="text/css">
<!--
body {
background-color: #D7F0FF;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.sty12 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: normal;
background-color: #FFFFFF;
}
.sty1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
}
.style1 {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 24px;
color: #FFFFFF;
font-weight: bold;
}
#wrapper { MARGIN: 0px auto; VERTICAL-ALIGN: middle; TEXT-ALIGN: left }
.style3 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #333333;
}
.style5 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: bold;
color: #ffffff;
}
.style7 {
color: #026465;
font-size: 9px;
}
.toprow {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: bold;
background-color: #CCCCCC;
}
-->
</style>
<script type="text/javascript">
function postData(someValueToEvalute)
{
switch(someValueToEvalute){
case "1":{
document.forms[0].action = 'invoiceprint2.php'
break;
}
case "2":{
document.forms[0].action = 'invoiceprint3.php'
break;
}
default: { alert('fail');}
}
document.forms[0].submit();
}
</script>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#026465">
<tr>
<td><div align="center"><span class="style1"> PACE LTD <br></span>
<center class="style5">INVOICE PRINTING</center>
<br><br>
<br>
</td>
</tr>
</table>
<!--------------VALIDATIONS ------------------->
<br>
<br>
<form name="form1" method="post" action="" target="_blank">
<table width='40%' height='39' border='0' cellpadding='2' cellspacing='0'>
<tr>
<td width=10> </td>
<td class='sty1'><div align='left'>Please select Invoice No. to PRINT: <br>
<br>
You can choose more than one invoice number from the options, by holding CTRL key on your keyboard and select the numbers.</div></td>
<td>
<?php
$dbservertype='mysql';
$servername='localhost';
$dbusername='itec';
$dbpassword='!@#';
$dbname='vga';
////////////////////////////////////////
////// DONOT EDIT BELOW /////////
///////////////////////////////////////
connecttodb($servername,$dbname,$dbusername,$dbpassword);
function connecttodb($servername,$dbname,$dbuser,$dbpassword)
{
global $link;
$link=mysql_connect ("$servername","$dbuser","$dbpassword");
if(!$link){die("Could not connect to MySQL");}
mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error());
}
//////// End of connecting to database ////////
$result = mysql_query("SELECT Invno FROM INVHDR ORDER BY Invno DESC");
echo "<select multiple='multiple' size='20' name='invnos[]'>";
while($nt=mysql_fetch_assoc($result))
{//Array or records stored in $nt
echo "<option value=$nt[Invno]>$nt[Invno]</option>";
/* Option values are added by looping through the array */
}
echo "</select>";// Closing of list box
echo "</td>";
?>
</tr>
</table><br>
<div id="Layer1" style="position:absolute; left:465px; top:115px; width:600px; height:600px; overflow:scroll; z-index:1; background-color: #D7F0FF; layer-background-color: #FFFFFF;">
<?php
echo "<table width='540' border='1' cellspacing='0' cellpadding='5' align='left'>";
echo "<tr>";
echo "<td width='75' align='center' class='toprow'>Inv Date</td>";
echo "<td width='75' align='center' class='toprow'>Inv No.</td>";
echo "<td width='315' align='center' class='toprow'>Customer Name</td>";
echo "<td width='75' align='center' class='toprow'>Amount</td>";
echo "</tr>";
$recs=mysql_query("SELECT * FROM INVHDR ORDER BY Invno DESC");
while ($r2=mysql_fetch_assoc($recs))
{
$invno=$r2['Invno'];
$invdat3=$r2['Invdate'];
$invdat2=date("Y-m-d", strtotime($invdat3));
//$invdat2->format('Y-m-d');
$date_array = explode( "-", $invdat2 );
$invdat = sprintf( '%02d/%02d/%4d', $date_array[2], $date_array[1], $date_array[0] );
$acode=$r2['Ac_code'];
$amt=$r2['Amount'];
//--selecting customer name-----------------------------------
$cus=mysql_query("SELECT Ac_desc FROM ACMAST WHERE Ac_code='$acode'");
$cus2=mysql_fetch_assoc($cus);
$acdesc=$cus2['Ac_desc'];
echo "<tr>";
echo "<td width='75' align='center' class='sty12'>$invdat</td>";
echo "<td width='75' align='center' class='sty12'>$invno</td>";
echo "<td width='315' align='center' class='sty12'>$acdesc</td>";
echo "<td width='75' align='center' class='sty12'>$amt</td>";
echo "</tr>";
}
echo "</table><br></div>";
?>
<table width='500' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td width=10> </td>
<td align='center'>
<input name="PRINT" type="button" value="PRINT Invoice to Laser Printer!" onClick='postData("1");' />
<input name="PRINT2" type="button" value="PRINT Invoice to Dotmatrix Printer !" onClick='postData("2");'/>
</form>
<br><br><br><br>
<a href='frameinvoice.php' target='_parent'><input name='Add' type='button' value='Add'></a> <a href='invoice-edit.php' target='_parent'><input name='Edit' type='button' value='Edit !'></a> <a href='invoice-cancel.php' target='_parent'><input name='Edit' type='button' value='Cancel !'></a> <a href='index.htm' target='_parent'><input name='Close' type='button' value='CLOSE !'></a><br>
</td>
</tr>
</table>
</body>
</html>