questions in using sort()

questions in using sort()

When I sort the percentage column,there won't display the right results. Is the sort() method not applide to sorting numeric variables?


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sort</title>
<style type="text/css">
tr{
font-family:Arial, Helvetica, sans-serif;
font-size:15px;
border:1px solid grey;
background-color:#CCC;
}
</style>
<script src="jqueryV1.10.2.js"></script>
<script>
$(function(){
var sortDirection=1;
$('th').each(function(i){
$(this).click(function(){
if(sortDirection == -1)
{
sortDirection=1;
}
else
{
sortDirection=-1;
}
var $arr_table=$(this).parent().parent().parent().find('tbody>tr').get();
$arr_table.sort(function(a,b){
var stra=$(a).children('td').eq(i).text().toUpperCase();
var strb=$(b).children('td').eq(i).text().toUpperCase();
if(stra > strb) return sortDirection;
if(stra < strb) return -sortDirection;
return 0;
});
$.each($arr_table,function(i,row){
$('tbody').append(row);
});
});
});
});
</script>
</head>

<body>
<table>
<thead>
<tr>
<th>title</th>
<th>percentage</th>
</tr>
</thead>
<tbody>
<tr>
<td>C</td>
<td>17.80</td>
</tr>
<tr>
<td>Java</td>
<td>17.25</td>
</tr>
<tr>
<td>PHP</td>
<td>6.25</td>
</tr>
<tr>
<td>C#</td>
<td>6.06</td>
</tr>
<tr>
<td>C++</td>
<td>10.04</td>
</tr>
</tbody>
</table>
</body>
</html>