首先,我用这个打开一个新窗口

  $('input#btn_show').click(function(event){
NewWindow("?mod=autorisasi_report", "autorisasi", 600, 400, "no");}
    );


然后,如果授权成功,它将打开窗口打开器

function run_submit(){
        window.opener.doreport(frm);

    window.close();
    return false;
}


但是问题出在函数报告中

function doreport(frm)
{
   if(frm.reptype.value == 'income_statement_period')
   {
    popFullScreen("print.php?mod=accounting_report_print&cmd="+frm.reptype.value+'&is_excel='+frm.is_excel.value+'&ryear='+frm.ryear.value+'&rmonth='+frm.rmonth.value+'&gpid='+frm.gpid.value+'&coaid='+frm.coaid.value+'&coaid2='+frm.coaid2.value+'&tbtype='+frm.tbtype.value+'&startdate='+frm.startdate.value+'&enddate='+frm.enddate.value+'&{SID}'+'&cctype='+frm.cctype.value,frm.reptype.value);
   }
}

<form name="frm" id="frm" action="" method="GET" style="width: 700px;">
 ...
<select name="reptype" onchange="change_reptype(frm);">
    <option value='trial_balance'> Trial Balance</option>
</select>
 ...
</form>


frm.reptype未定义,我该怎么做才能获得reptype值?

最佳答案

您在函数run_submit中使用变量frm遇到问题。没有为此声明。您应该先在函数run_submit中声明。

或者您可以在函数do_report中用此声明frm

var frm = document.getElementByID('frm');

因为您需要先声明表单。

关于javascript - 在javascript上获取Window.opener.function上的值,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/54000592/

10-11 13:24