我需要把投票的结果用进度条来显示啊,知道的能讲解下吗?
我的页面是JSP的,最好有个例子哦

解决方案 »

  1.   

    是不是这样的?<div style="width:200px;border:1px solid #ccc;">
    <div style="width:(本选项得票/总投票数*100)%;background:#ccc;"></div>
    <div style="width:(本选项得票/总投票数*100)%;background:#ccc;"></div>
    </div>
      

  2.   

    原理就是用抽票结果值,经过简单计算后,用来标识元素的width属性.可以是div或图片==
      

  3.   

    <div style="width:200px;border:1px solid #ccc;height:20px"> 
    <div style="width:(<%= 本选项得票/总投票数*100 %>)%;background:#ccc;height:20px"> </div> 
    </div> 
    </div>
      

  4.   

    <div style="width:200px;border:1px solid #ccc;height:20px"> 
    <div style="width:<%= 本选项得票/总投票数*100 %>%;background:#ccc;height:20px"> </div> 
    </div> 
    </div>
      

  5.   

    这两个DIV我是放在<td></td>里的,没效果
      

  6.   


    <div style="width:200px;border:1px solid #dcdcdc;height:20px;"> 
    <div style="width:0px;height:20px;background:red" id="test"></div>
    </div> 
    <script>
    var i=0;
    var run=function(){
    i++;
    document.getElementById('test').style.width=i+'%';
    if(i==100)
    return;
    setTimeout(function(){run()},50);
    }
    run();
    </script>
      

  7.   

    我这里多个投票项,我用不通颜色的图片来显示的<DIV class=l style="WIDTH: 400px">
    <DIV class=vl1>
    <DIV class="l w230 tar"><%=resultSet.getString(1)%>:</DIV>
    <DIV class="ml10 l w180">
    <DIV class=tpbg1>
    <DIV class=l style="MARGIN-TOP: 2px"><IMG src="images/v<%=i%>.gif"></DIV>
    <DIV class="l vbg<%=i%>" id="test" style="WIDTH: 0%"></DIV>
    <DIV class=l style="MARGIN-TOP: 2px">
    <IMG src="images/v<%=i%>b.gif"></DIV></DIV></DIV>
    <DIV class="w65 l"></DIV>
    <DIV class=l></DIV>
    </DIV>
                  </DIV>我这里的图片宽度应该怎么取了?