0

我有这个代码,用户选择一个销售中心,然后它会更改货币,它们都是下拉菜单,我遇到的问题是当我选择一个销售中心时出现错误 ReferenceError: makeRequest is not defined。我不确定我说得对还是发生了什么。我不确定我的 xmlhttprequest 部分是否正确(第一次这样做)

HTP.P('<td class="reqlabel1">Sales Center:</td>');
HTP.P('<td class="tablelabel">');
HTP.P(Get_Sc_Dd(PVNAME=>'pnSalesCenterID', PVORAID=> VUSERNAME, PVDEFVAL => NSALESCENTERID, PVEVENT=>'class="reqinput1" onChange="makeRequest();" style="width:260px"'));
HTP.P('</td>

');

CURRDEF := get_criteria_rec('PROCURR_DEF',dml_p_oracle_user.get_rec(VUSERNAME).global_region).include_list;


HTP.P( '...>
function makeRequest(){
ajaxReq = (window.XMLHttpRequest)? new XMLHttpRequest() : new ActiveXObject("MSXML2.XMLHTTP")

ajaxReq.open("POST","contr_entry_pkg.sales_center_dropdown?&pnSalesCenterID="document.getElementById("pnSalesCenterID")+ "&pvCurrCd="document.getElementById("'||CURRDEF||'"),true);
ajaxReq.onreadystatechange =function()currencychange;

ajaxReq.send()
}
function currencychange(){

if(ajaxReq.readyState == 4){
if(ajaxReq.status == 200){
//var resultsJSON = eval(''('' + ajaxReq.responseText + '')'');
document.getElementById("pvCurrCd").innerHTML = ajaxReq.responseText;

}

}
}');
   HTP.P( '</script>');
                    HTP.P('<td class="reqlabel1">Currency:</td>');
        HTP.P('<td class="tablelabel">');

         HTP.P(Get_currencyCode_Dd(PVNAME=>'pvCurrCd', 
         PVDEFVAL =>NULL,    
           PVEVENT=>'class="reqinput1"onBlur="makeRequest() style="width:200px"'));
       HTP.P('</td>');
4

1 回答 1

0

这不是正确的 Javascript 语法:

ajaxReq.onreadystatechange =function()currencychange;

它应该是:

ajaxReq.onreadystatechange = currencychange;
于 2013-11-05T04:04:31.300 回答