javascript:如何设置宽度? [英] javascript: how to set the width?

查看:89
本文介绍了javascript:如何设置宽度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

db1.transaction(function(transaction)
       {
         transaction.executeSql('SELECT t1.*,t2.cust_name,t2.current_bal FROM invoice t1 ,customer t2 where t1.cust_code=t2.cust_code' , [],  function(transaction, result)
         {
	 if (le != 0)
	         {  
			  myTable= "<table class='sorting' id='sorting' bgcolor='#00cafe' >";
		   for (var i = 0; i < result.rows.length; i++) 
			 { 	  
	              var row = result.rows.item(i);
                      var arrayBalance=new  Array();
	               arrayBalance[i]=bal;
                      array=getPercentage(arrayBalance[i]);//width value 

  myTable+="<tr><td class='name' style='width: 300px; height:50px; padding: 0.5em 0 0.1em 0; text-align:right;' >"+myArray[i] +"</p></td><td><div class='progress'><div class='progress-bar' style='{width:'"+(array+'%')+"'}'></td></tr>"; 
	myTable += "</table>";
				  document.getElementById('invoiceTable').innerHTML=myTable;		
			}
}
});
});







function getPercentage(bal)
{
    console.log(bal);
    var balance=(parseFloat(bal)/100);
    return balance;
}





// css



//css

.progress {
    background: none repeat scroll 0 0 #333;
    border-radius: 5px;
    height: 14px;
   margin: 20px 20px 20px 0;
}
.progress-bar {
    background: none repeat scroll 0 0  #F00;
    border-radius: 5px 0 0 5px;
    height: 14px;
}





我需要显示一个进度条但不是动画的..带宽度值取自表格并计算出来。上面的代码显示填充了css中指定颜色的条形。如何才能将颜色填充到指定的百分比?

任何人都可以帮助我.. ..



I need to display a progress bar but not an animated one..with the width value taken from table and calculated.The above code displays the bar filled with the colour specified in css.How can I fill the colour only to the specified percentage??
Can anybody help me plzz..

推荐答案

Hi Payal,



查看< a href => http://ruwix.com/simple-javascript -html-css-slider-progress-bar / [ ^ ]



祝你好运
Hi Payal,

Check this http://ruwix.com/simple-javascript-html-css-slider-progress-bar/[^]

Good Luck


这篇关于javascript:如何设置宽度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆