여기 새로 왔습니다. 나는 데이터베이스에서 데이터를 보여줄 수있는 테이블을 만들고, 선택 될 데이터를 보여줄 1 개의 테이블을 더 만든다. 그러나 문제는 우리가 단지 몇 가지 데이터를 선택하면 문제가되지 않을 것이라는 것입니다. 그러나 100 개 이상의 데이터를 선택하면 레이아웃 문제가 발생할 수 있습니다. 스크롤바 만드는 법?
이 내 코드
... 는<script type="text/javascript">
function List(){
var selectedProduct = "";
var product = document.getElementById('product');
var output ="";
var k = 0;
var name = new Array;
var model = new Array;
var unitprice = new Array;
<?php foreach ($productPrices as $price): ?>
name[k] = "<?php echo $price['Product']['txtname']; ?>";
model[k] = "<?php echo $price['Product']['txtmodel']; ?>";
k++;
<?php endforeach; ?>
k=0;
for (var i = 0; i < product.length; i++) {
k = product.options[i].value;
if (product.options[i].selected) {
output += '<tr>'+
'<td style="border-right: 0px; width:270px; text-align:center" id="ProductProduct'+k+'" name="data[Product][Product]['+k+']">'+name[i]+'</td>'+
'<td style="border-right: 0px; width:100px; text-align:left" id="ProductProduct'+k+'" name="data[Product][Product]['+k+']">'+model[i]+'</td>'+
'</tr>';
}
}
output = '<table style="width:500px; border: 0px;">'+output+'</table>';
document.getElementById('productTable').innerHTML = output;
}
</script>
<table cellpadding="0" cellspacing="0" style="width:100%">
<caption><div align="left">Peoduct Selection</div></caption>
<tr>
<th style="width:25%"><font><div align="left">Select Product :</div></font>
<?php echo $form->input('Product',array(
'label' => 'Select Products',
'options' => $products,
'id'=>'product',
'style'=>'width:250px;height:100px',
'selected' => $html->value('Product.Product'),
'onchange'=>'List();')); ?> </th>
<th ><table>
<tr>
<th style="width:400px"><div align="center">Product Name</div></th>
<th style="width:250px"><div align="center">Product Model</div></th>
</tr>
<tr>
<td colspan="4" ><span id="productTable"></td>
</tr>
</table></th>
</tr>
</table>
사람은 내가이 문제를 해결 도와 드릴까요? thx ..
왜 내 리 태그를 변경 했습니까? 이 질문은 PHP와는 아무 관련이 없으며 레이아웃 때문에 HTML/CSS 문제입니다. – fresskoma
@ x3ro - 나는 추측하고있다. 그러나 실수로 편집을했을 때 이미 편집을하고 있었다. –