Click here to Skip to main content
15,912,400 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
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;		
			}
}
});
});


C#
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;
}


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..
Posted
Updated 3-Jun-14 23:01pm
v3

1 solution

 
Share this answer
 
Comments
p@y@l 4-Jun-14 6:46am    
style property producing error!!
Ajith K Gatty 4-Jun-14 7:01am    
Error in Style??? what error?
p@y@l 4-Jun-14 7:05am    
Uncaught TypeError: Cannot read property 'style' of null

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900