using varibles in selectors

using varibles in selectors

Hi all,
There is this issue I've been struggling with.I am working on a code that requires me to perform the same action(function) on page elements with different but identical ids of the form:
#edit-pola-r1-c1 for first row,first column
#edit-pola-r1-c2 for first row, second column
#edit-pola-r2-c1 for second row,first column
It's actually a table.
Now, the problem is I'll like to take the values of the first columns and perform some operations on them.My current implementation is as follows.
$(document).ready(function(){
var rows = new Array("r1","r2","r3");
for(i=0;i<3;i++){
$('#edit-pola' + rows[i] + '-c1').keyup(function(){
var name = $('#edit-pola-' +rows[i] + '-c1').val();
alert(name); //just for the purpose of illustration
});
}
});

Presently, the corresponding html of that portion of page is:

<form action="/drupal6/try" accept-charset="UTF-8" method="post" id="-posh-test-form">
<div><span id="thmr_11" class="thmr_call">
<fieldset><legend>Emergence</legend><span id="thmr_5" class="thmr_call">
<table><tr><td><span id="thmr_1" class="thmr_call">
<div class="form-item" id="edit-pola-r1-c1-wrapper">
<input type="text" maxlength="128" name="pola[r1][c1]" id="edit-pola-r1-c1" size="20" value="" class="form-text required" />
</div>
</span>

</td><td><span id="thmr_3" class="thmr_call">
<div class="form-item" id="edit-pola-r1-c2-wrapper">
<input type="text" maxlength="128" name="pola[r1][c2]" id="edit-pola-r1-c2" size="20" value="" class="form-text required" />
</div>
</span>

</td></tr></span>

<span id="thmr_10" class="thmr_call">
<tr><td><span id="thmr_6" class="thmr_call">
<div class="form-item" id="edit-pola-r2-c1-wrapper">
<input type="text" maxlength="128" name="pola[r2][c1]" id="edit-pola-r2-c1" size="20" value="" class="form-text required" />
</div>
</span>

</td><td><span id="thmr_8" class="thmr_call">
<div class="form-item" id="edit-pola-r2-c2-wrapper">
<input type="text" maxlength="128" name="pola[r2][c2]" id="edit-pola-r2-c2" size="20" value="" class="form-text required" />
</div>
</span>

PS:The relevant html elements are the <input......> ones.

Currently, no alert pops up and I don't seem to know what is going on here.What am I doing wrong?