在函数 HTML 中运行 getelementbyid



所以在我的JavaScript文件中我有这个

document.getElementById('bodyresize').onclick = function() 

因此,当我使用此代码按下按钮时,它会启动该函数:

<button id="bodyresize">Click Me test</button>

但现在,当我按下一个函数在我的 HTML 脚本中启动时,我需要另一个按钮结束:

 function resizeanshow()
  {
  showhide();
  }

在该函数中,首先 showhide() 做它的事情但现在的问题是:

我可以在同一函数中运行 bodyresize 的代码是什么

做:

document.getElementById('bodyresize').onclick = function() {
  showhide();
  //do further coding for resizing here
  console.log('resize method');//logs in the console after showhide();
};

最新更新