我有这个代码,用户选择一个销售中心,然后它将更改货币 这两个都是下拉,我遇到的问题是当我选择销售中心时我会收到错误 ReferenceError:未定义makeRequest。我不确定我是否正确或正在发生什么。我不确定我是否正确执行了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>');
答案 0 :(得分:0)
这是不正确的Javascript语法:
ajaxReq.onreadystatechange =function()currencychange;
它应该是:
ajaxReq.onreadystatechange = currencychange;