As well as the prefixing that Victor describes, a row index is also added to the ID to ensure all the ID values are unique. So when writing JavaScript to deal with apex:pageblockTable
generated output, it can be easier to make use of CSS classes (that have no styles associated) as column markers rather than try to generate the ID values.
Here is an example. I'm afraid it isn't your problem but rather how to have the product of two fields in each row displayed in a third field. But it illustrates the use of the CSS classes plus how jQuery helps with handling the open ended number of rows and finding values in the same row.
The Visualforce:
<apex:pageBlockTable value="{!items}" var="item">
<apex:column headerValue="{!$ObjectType.LineItem__c.fields.Days__c.label}">
<apex:inputField value="{!item.Days__c}" styleClass="daysMarker"/>
</apex:column>
<apex:column headerValue="{!$ObjectType.LineItem__c.fields.RatePerDay__c.label}">
<apex:inputField value="{!item.RatePerDay__c}" styleClass="ratePerDayMarker"/>
</apex:column>
<apex:column headerValue="{!$ObjectType.LineItem__c.fields.Amount__c.label}">
<apex:inputField value="{!item.Amount__c}" styleClass="amountMarker"/>
</apex:column>
</apex:pageBlockTable>
and the JavaScript to put at the end of the Visualforce:
<apex:includeScript value="{!URLFOR($Resource.jQueryZip, 'jquery.js')}" />
<script>
(function($) {
$(document).ready(function() {
var product = function(left, right, result) {
if (isFloat(left.val()) && isFloat(right.val())) {
result.val(parseFloat(left.val()) * parseFloat(right.val()));
}
};
$('input.daysMarker').change(function() {
var days = $(this);
var rate = days.closest('tr').find('input.ratePerDayMarker');
var amount = days.closest('tr').find('input.amountMarker');
product(days, rate, amount);
});
$('input.ratePerDayMarker').change(function() {
var rate = $(this);
var days = rate.closest('tr').find('input.daysMarker');
var amount = rate.closest('tr').find('input.amountMarker');
product(days, rate, amount);
});
});
})(jQuery.noConflict());
</script>