
通过传入当前需要显示的Id,自动展开对应的条目。($current_news_id标示当前Id)
<script type="text/javascript"> <!-- $(document).ready(function(){ $("div").filter(".handler").click( function() { $(this).next(".news_detail").toggle(); }); $('#n<? echo $current_news_id; ?>').css("display","block"); }); //--> </script> <style> <!-- .newItem{margin-bottom:10px; } .clickme{cursor:pointer;} .news_detail{display:none;} --> </style>
<? foreach ($news as $newItem){ ?> <div class="newItem" style="width:100%;"> <div class="handler nav_font" > <a><?php echo $newItem->title; ?></a> <span style="color:#CCCCCC;font-size:12px;font-weight:400"><?echo date('Y年m月d日 H:i', $newItem->pubtime); ?></span></div> <div id="n<? echo $newItem->news_id; ?>" class="news_detail"> <table> <tr><td valign="top"><div><?php echo $newItem->content; ?> </div></td></tr></table> </div></div> <?} ?>
本页面链接地址(或者引用地址 Trackback)




发表评论