Я бы использовал jQuery
$(function (){
$.each($('.nums'), function () {
$(this).html(Number($(this).html().replace(/,/g,"")) /*your math here*/);
});
});
В ответ на ваши изменения:
Так как мне скучно, я написал этот рабочий код для вас, закруглите и вставьте ',' как считаете нужным.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<table class="Table" >
<thead><tr>
<th class="l Header" scope="col">£000s</th>
<th class="l Header" scope="col">Col1</th>
<th class="l Header" scope="col">Col2</th>
</tr></thead>
<tbody>
<tr>
<td class="l Data"> My Data Row </td>
<td class="l Data"> <a class="nums" href="javascript:MyFunc();"> 11,372,397</a></td>
<td class="l Data"> <a class="nums" href="javascript:MyFunc();"> 11,344,327</a></td>
</tr>
</tbody>
<input type="button" onclick="toMillions();">
<input type="button" onclick="restore();">
<script type="text/javascript">
$(function (){
$.each($('.nums'), function () {
$.data(this, "theValue", $(this).html());
});
});
function toMillions(){
$.each($('.nums'), function () {
$(this).html(Number($.data(this,"theValue").replace(/,/g,"")) / 1000000 + ' million');
});
}
function restore(){
$.each($('.nums'), function () {
$(this).html($.data(this,"theValue"));
});
}
</script>