我在javascript上出错了
值未定义
我在行式上基于Styleclass进行计算。所以我就像下面的代码一样。
function onChangeFactor(val,idx)
{
var Factor=val;
var FunderList=document.getElementsByClassName('FundedOfferClass');
var PaybackList=document.getElementsByClassName('PaybackOfferClass');
console.log('-------> IDX'+idx);
var Funded=FunderList[idx].value;// getting error on this line
Funded=Funded.replace(/,/g,'');
if(Funded!=null || Factor !=null){
var Payback= (parseFloat(Funded)*parseFloat(Factor)).toFixed(2);
PaybackList[idx].value=Payback;
}
if(isNaN(Payback)){
PaybackList[idx].value=0;
}
}
<apex:column headerValue="Terms(In Days)">
<apex:inputField value="{!O.Offer.Terms_In_Months__c}" styleClass="offerTermClass" id="OfferTerm" rendered="{!!O.IsEditable}" onchange="onChangeTerm(this.value)"/>
<apex:outputField value="{!O.Offer.Terms_In_Months__c}" rendered="{!O.IsEditable}"/>
</apex:column>
<apex:column headerValue="Funding Amount">
<apex:inputField value="{!O.Offer.Funding_Amount__c}" styleClass="FundedOfferClass" id="FundedOffer" rendered="{!!O.IsEditable}" onchange="onChangeFunded(this.value);"/>
<apex:outputField value="{!O.Offer.Funding_Amount__c}" rendered="{!O.IsEditable}"/>
</apex:column>
<apex:column headerValue="Factor Rate">
<apex:inputField value="{!O.Offer.Factor_Rate__c}" styleClass="FactorOfferClass" id="FactorRate" rendered="{!!O.IsEditable}" onchange="onChangeFactor(this.value,{!O.Index});" />
<apex:outputField value="{!O.Offer.Factor_Rate__c}" rendered="{!O.IsEditable}"/>
</apex:column>
<apex:column headerValue="Payback Amount">
<apex:inputField value="{!O.Offer.Payback_Amount__c}" styleClass="PaybackOfferClass" id="PaybackOffer" rendered="{!!O.IsEditable}" html-disabled="true"/>
<apex:outputField value="{!O.Offer.Payback_Amount__c}" rendered="{!O.IsEditable}"/>
</apex:column>
我们如何解决这个问题?