javascript - 隐藏和显示 onclick 功能

标签 javascript html

我的功能运行良好。但是我似乎无法在使用 onclick 功能时隐藏按钮或显示新按钮。

示例:

  var download = document.getElementById('download');
  function RemoveDoc(Doc)
  {
xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET","functions/remove.php?Doc="+Doc,true);
xmlhttp.onreadystatechange=function()
{
    if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {

        download.syle.visibility='hidden';
        download.style.display ='none'
        document.getElementById("RemoveMsg").innerHTML= xmlhttp.responseText;
    }
}
xmlhttp.send();

    return false;

我的表单

   //I tried to add in the download button to be hidden here but still invalid
   <input type="submit" id="remove" name="Name" value="Remove" onclick="return RemoveDoc(this.value); document.getElementById('download').style.visibility='hidden'; return false;" />
   <input type="submit" id="download" value="download"/> //want to hide this button.
   <input type="file" id="reupload"/> //want to show this.

我试过 display = 'none' 也无效,因为我的下载在函数调用成功后消失。请多多指教

最佳答案

download.style.visibility='hidden';

关于javascript - 隐藏和显示 onclick 功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11464834/

相关文章:

html - 输入响应宽度 Bootstrap

javascript - 通过 ajax 返回的颜色框和内容

css - 文档类型的更改导致网页以不同方式呈现

php - 从 php 中的文本框获取一个值,调用另一个 php 文件并将此文本框值作为变量传递给它

java - struts在没有js的情况下验证后专注于字段

html - 在 2 个左/右对齐的 div 之间 float div

javascript - 如何在 AngularJS 项目中使用 swagger 生成 "javascript-closure-angular-client"

php - 使用 AJAX 检索 HTML 下拉列表值

javascript - KnockoutJS ArrayFirst 无法按预期工作

javascript - 显示 "Unsupported"浏览器消息的最佳方式