滚动字幕的代码怎么写,滚动的内容怎么从数据库中显示出来

解决方案 »

  1.   

    取到数据库的内容,放到   <marquee></marquee>标签中。自己设样式....
      

  2.   

     <div id="scrollScrip" align="left">最新10条许愿:
      <marquee direction="left" scrollamount="2" width="90%" height="30" onMouseMove="this.stop()" onMouseOut="this.start()">
      <span id="scrollScripContent">正在获取许愿内容......</span>
      </marquee>
    </div>数据库中的内容要放哪里,怎么写?
      

  3.   

    给你个示例:其中的东东根据你的配置自己更改。
    <?php
       $conn = mysql_connect('' ,'','') or die("cannot connect to the database");;//换成你的
       mysql_select_db("dbname");
       $sql = "select * from content where .......";//根据你的具体条件查询。
       $res = mysql_query($sql);
       echo <<<HTML
         <div id="scrollScrip" align="left">最新10条许愿:
        <marquee direction="left" scrollamount="2" width="90%" height="30" onMouseMove="this.stop()" onMouseOut="this.start()">
    HTML;
       while($result = mysql_fetch_array($res)){
           echo $result['content']."<br/>";
       }
      echo <<<HTML
      <span id="scrollScripContent">正在获取许愿内容......</span>
      </marquee>
    </div>
    HTML;
    ?>