Javascript 单击后禁用按钮,是否应适用于所有类型的浏览器? 函数disableLbtSend(){ document.getElementById(“”).disabled=true; } window.onbeforeunload=disableOgSend;

Javascript 单击后禁用按钮,是否应适用于所有类型的浏览器? 函数disableLbtSend(){ document.getElementById(“”).disabled=true; } window.onbeforeunload=disableOgSend;,javascript,asp.net,Javascript,Asp.net,我想在点击后禁用按钮,并为其编写了上述代码。它在IE中运行良好,但在chrome和Mozilla中则不行。如何获得所需的解决方案您可以向按钮添加一个单击处理程序,该按钮在触发后会自动删除: function disableLbtSend() { document.getElementById('<%=Buttonclick.ClientID%>').disabled= true; } window.onbeforeunload = disableOgSend; const

我想在点击后禁用按钮,并为其编写了上述代码。它在IE中运行良好,但在chrome和Mozilla中则不行。如何获得所需的解决方案

您可以向按钮添加一个单击处理程序,该按钮在触发后会自动删除:

function disableLbtSend() {
  document.getElementById('<%=Buttonclick.ClientID%>').disabled= true;
}
window.onbeforeunload = disableOgSend;  
const buttons=document.queryselectoral('button');
for(设i=0;i
单击一次
点击一下
单击一次
尝试用户jquery

function clickOnceHandler(e) {
  // Do something.
  alert('Do something then disable the button');

  // Disable your button.
  e.target.disabled = true;

  // Remove this click handler.
  e.target.removeEventListener(e.type, clickOnceHandler);
}
函数disableLbtSend(){
$('#'+'').prop('disabled',true);
}
使用jquery尝试以下操作:

函数disableLbtSend(){
$('#'+'').attr(“禁用”、“禁用”);
}

您可以使用jQuery,因为它将为您提取浏览器细节。希望如此。可能是重复的
function disableLbtSend() {
  $('#' + '<%= Buttonclick.ClientID %>').prop('disabled', true);
}
function disableLbtSend() { 
    $('#' + '<%= Buttonclick.ClientID %>').attr("disabled", "disabled");
}