JS点击显示,收起
<?php
foreach($categorys as $key=>$item){
?>
<tr>
<td class="lc_flgl_pdsx_10" onclick="showCateData(this);">
<div class="lc_dp_flgl_name" style="cursor:pointer">
<?php echo $item['name'];?>
</div>
</td>
<td align="center"><?php echo $item['orderNumber'];?></td>
<td align="center"><?php echo $item['subCategoryCount'];?></td>
<td align="center"><?php echo StringUtil::formatDate($item['createdTime']);?></td>
<td align="center"><a href="action.php?operation=deleteStoreCategory&categoryId=<?php echo $item['categoryId'];?>" onclick="" class="lc_bule">删除</a>
<a href="category.php?operation=updateStoreCategory&categoryId=<?php echo $item['categoryId'];?>" class="lc_bule">修改</a> <a href="#" class="lc_bule">查看</a></td>
</tr>
<tr style="display:none" id="CateData" name="CateData">
<td colspan="5">
<table width="100%" border="0" cellspacing="0" id="tab" cellpadding="0">
<?php
$sql = "SELECT * FROM goods_category WHERE storeId=:storeId AND parentId=:parentId";
$stmt= $con->prepare($sql);
$stmt->bindParam(":parentId", $item['categoryId']);
$stmt->bindParam(":storeId", $theStoreId);
$stmt->execute();
$category_childs = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($category_childs as $value){
?>
<tr>
<td class="lc_flgl_pdsx_10">
<div class="lc_dp_flgl_name_zl">
<?php echo $value['name'];?>
</div>
</td>
<td align="center" width="17%"><?php echo $value['orderNumber'];?></td>
<td align="center" width="14%"><?php echo $value['subCategoryCount'];?></td>
<td align="center" width="17%"><?php echo StringUtil::formatDate($value['createdTime']);?></td>
<td align="center" width="15%"><a href="action.php?operation=deleteStoreCategory&categoryId=<?php echo $value['categoryId'];?>" class="lc_bule">删除</a>
<a href="category.php?operation=updateStoreCategory&categoryId=<?php echo $value['categoryId'];?>" class="lc_bule">修改</a> <a href="#" class="lc_bule">查看</a></td>
</tr>
<?php }?>
</table>
</td>
</tr>
<script type="text/javascript">
//功能:点击显示修改元素表单;
function showCateData(CateData){var CateData = CateData.parentNode.nextSibling.nextSibling;if(CateData.style.display=="none"){
CateData.style.display="";
}else{CateData.style.display="none";}}
</script>