dqyp50298 2017-03-30 06:29
浏览 34
已采纳

如何横向逐一显示新闻?

code:

<?php
   $query = "select * from latest_news limit 0,10";
   $fet = mysqli_query($link,$query);
   while ($fetch = mysqli_fetch_array($fet)) 
    {
      $news_title = $fetch['news_title'];
    }
?>

html code:

<marquee onmouseover="this.stop();" onmouseout="this.start();">
    <h3 id="news-h3"><?php echo $news_title; ?></h3>
</marquee>

I am diplaying news_title using marquee but here only one data are showing. I want to display all news_title one by one. So, how can I do this.

Thank You

  • 写回答

2条回答 默认 最新

  • dsfs23434 2017-03-30 06:38
    关注

    Here is what you want.

    <marquee onmouseover="this.stop();" onmouseout="this.start();">
        <?php
            $query = "select * from latest_news limit 0,10";
            $fet = mysqli_query($link,$query);
            while ($fetch = mysqli_fetch_array($fet)) 
            {
              $news_title = $fetch['news_title'];
              ?>
                <span id="news-h3"><?php echo htmlspecialchars($news_title); ?></span>
              <?php
            }
        ?>
    </marquee>
    

    Use CSS to style news span. If you want to use h3 tag then style it also like:

    <style>
    h3 {
       display: inline;
    }
    </style>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度