#scrolling_1 { width:635px; height:240px; overflow:hidden; padding:1px; border:1px solid #999; margin:0 auto; text-align: left; }
#scrollnews_1 { position:absolute; width:645px; height:240px; overflow:hidden; display:inline; top:1; left:1; }
#scrollnews_con_1 { width:645px; overflow:hidden; }
#scrolling_1 ul { display:block; height:240px; width:645px; }
#scrolling_1 ul li { height: 240px; width: 205px; float: left; overflow:hidden; display: inline; margin-right: 10px; }
这个我想给PHP变量付值后输出。
<?
for (i=0 ;i=100; i++) {
echo "#scrolling_1 { width:635px; height:240px; overflow:hidden; padding:1px; border:1px solid #999; margin:0 auto; text-align: left; }";
#scrollnews_1 { position:absolute; width:645px; height:240px; overflow:hidden; display:inline; top:1; left:1; }
#scrollnews_con_1 { width:645px; overflow:hidden; }
#scrolling_1 ul { display:block; height:240px; width:645px; }
#scrolling_1 ul li { height: 240px; width: 205px; float: left; overflow:hidden; display: inline; margin-right: 10px; }}
?>
这么写了以后,不正常了。
我该怎么写呢?

解决方案 »

  1.   

    for (i=0 ;i=100; i++) {
    循环写错了吧
      

  2.   

    变量前面要加$

    for ($i=0 ;$i=100; $i++) {
      

  3.   

    呵呵,
    上面的代码写错了。
    我从新写了。
    #scrolling_1 { width:635px; height:240px; overflow:hidden; padding:1px; border:1px solid #999; margin:0 auto; text-align: left; }
    #scrollnews_1 { position:absolute; width:645px; height:240px; overflow:hidden; display:inline; top:1; left:1; }
    #scrollnews_con_1 { width:645px; overflow:hidden; }
    #scrolling_1 ul { display:block; height:240px; width:645px; }
    #scrolling_1 ul li { height: 240px; width: 205px; float: left; overflow:hidden; display: inline; margin-right: 10px; }
    这个我想给PHP变量付值后输出。
    <?
    for ($i=0 ;$i<=100; $i++) {
    echo "#scrolling_1 { width:635px; height:240px; overflow:hidden; padding:1px; border:1px solid #999; margin:0 auto; text-align: left; }";
    #scrollnews_1 { position:absolute; width:645px; height:240px; overflow:hidden; display:inline; top:1; left:1; }
    #scrollnews_con_1 { width:645px; overflow:hidden; }
    #scrolling_1 ul { display:block; height:240px; width:645px; }
    #scrolling_1 ul li { height: 240px; width: 205px; float: left; overflow:hidden; display: inline; margin-right: 10px; }
     
    }
    ?>
    这么写了以后,不正常了。
    我该怎么写呢?
      

  4.   

    echo "****引号位置错了吧?? $i没用到 输出100个同样的样式?
      

  5.   


    <?php
    for ($i=0 ;$i<=100; $i++) {
    echo "#scrolling_1 { width:635px; height:240px; overflow:hidden; padding:1px; border:1px solid #999; margin:0 auto; text-align: left; }
    #scrollnews_1 { position:absolute; width:645px; height:240px; overflow:hidden; display:inline; top:1; left:1; }
    #scrollnews_con_1 { width:645px; overflow:hidden; }
    #scrolling_1 ul { display:block; height:240px; width:645px; }
    #scrolling_1 ul li { height: 240px; width: 205px; float: left; overflow:hidden; display: inline; margin-right: 10px; }
    ";
    }
    ?>