我无法使第二个javascript函数正常工作。
当我单击“发送邮件”按钮时,它应该调用第二个函数并传递这两个值。
href行(第一个函数的倒数第二行)显示不正确。

<script>
function getvals(first,second) {
    alert(''+first+'');
    alert(''+second+'');
    mywindow=window.open('','Send Mail','height=200,width=400');
    mywindow.document.write("<FORM NAME='test'>");
    mywindow.document.write("<table align='center'><tr><td>User/Group: </td><td><input type='text' id='newfirst' name='iuser'></td></tr>");
    mywindow.document.test.iuser.value = ''+first+'';
    mywindow.document.write("<tr><td>Issue Key: </td><td><input type='text' id='newsecond' name='ikey'></td></tr>");
    mywindow.document.test.ikey.value = ''+second+'';
    mywindow.document.write("<tr><td><a href='javascript:popitup(document.getElementById('newuser').value,document.getElementById('newkey').value);'>Send Mail</a></td></tr></table>");
    mywindow.document.write("</FORM>");
}
function popitup(user,key) {
    alert(''+user+'');
    alert(''+key+'');
    var url = 'http:\/\/localhost:8080/plugins/servlet/mailservlet?receiver=' + user + '&issue=' + key;
    newwindow=window.open(url,'name','height=400,width=400');
    if (window.focus) {newwindow.focus()}
}
</script>

最佳答案

函数popitup不会被调用,因为它是在父窗口中编写的,而不是在window.open打开的窗口中编写的。在函数调用中尝试window.opener

10-05 20:39
查看更多