我正在制作一个应用程序,用于链接他们的电子邮件,我希望当用户转到"file"时(将显示通过打开新选项卡链接/提交电子邮件的按钮,并且在他们提交电子邮件后打开的标签将被关闭)在关闭"new"标签后,将显示一个继续按钮,以便用户可以继续下一部分
最佳答案
这是我在我的网站上所做的及其工作。当用户单击按钮时,您告诉第二个窗口激活第一个窗口的功能。
这是我的做法:
窗口 1:
function enableButton() {
document.getElementById('disabled').disabled = false;
document.getElementById('disabled').innerText = 'not disabled';
}
<a>click me</a>
<br>
<button id='disabled' disabled>im disabled</button>
窗口 2:
function enableHim() {
let oldWin = window.opener;
oldWin.enableButton();
}
<button id='b' onclick='enableHim()'>click here to enable other button</button>
关于javascript - 在主窗口中禁用按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57658247/