我希望将数组函数的声明值 id_log 声明为 var id_L ,该怎么做?
function editcashiersession(id_log,d,e){
var vdt = $('h_dttm').value;
var vdt2 = $('h_dttm2').value;
var tbd = _gel('tblcashiersession');
var tr = d.parentNode.parentNode;
**var id_L = ('id_log');**
var curcashiersessioneditorid = _gel('rowcashiersession');
if (lastcashiersessioneditorid) {
_destroy(lastcashiersessioneditorid);
if (lastcashiersessioneditorid == curcashiersessioneditorid) {
lastcashiersessioneditorid = null;
d.value = 'Edit Log';
_gel('sessi_errmsg').innerHTML = '';
return;
}
}
答案 0 :(得分:0)
var id_L = id_log;
这就是你想要的而不是
var id_L = ('id_log');
仔细检查你的javascript,因为你没有关闭if语句:
function editcashiersession(id_log,d,e){
var vdt = $('h_dttm').value;
var vdt2 = $('h_dttm2').value;
var tbd = _gel('tblcashiersession');
var tr = d.parentNode.parentNode;
var id_L = id_log;
console.log(id_L); //delete this line after testing.
var curcashiersessioneditorid = _gel('rowcashiersession');
if (lastcashiersessioneditorid) { //You forget to close this if
_destroy(lastcashiersessioneditorid);
if (lastcashiersessioneditorid == curcashiersessioneditorid) {
lastcashiersessioneditorid = null;
d.value = 'Edit Log';
_gel('sessi_errmsg').innerHTML = '';
return;
}
} // I added this in order to close it
}
此外,您的代码上未设置lastcashiersessioneditorid。