document.getElementById(" remember")。visibility =" hidden&quot ;;不在复选框上工作 [英] document.getElementById("remember").visibility = "hidden"; not working on a checkbox

查看:94
本文介绍了document.getElementById(" remember")。visibility =" hidden&quot ;;不在复选框上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使用可见性显示属性。

这是HTML页脚:

<div id="footer">
  &copy; 
  <strong id="foot" onmouseover="showData();" onmouseout = "hideData()">
    Exquisite Taste 2012
  </strong>
  <input type='checkbox' id="remember" onclick='editCookie()' style="visibility:hidden;" />
</div>

以下是可见性部分无效的.js函数:

Here is the .js function with the visibility part not working:

function showData()
{


  document.getElementById("remember").visiblity="visible";


  document.getElementById("foot").innerHTML = getDate() + "  " + getTime();

  if(cookieValue())
  {
    document.getElementById("remember").checked = true;
  }
}

这一行似乎没有做任何事情:

That one line doesn't seem to do anything:

document.getElementById("remember").visiblity="visible";


推荐答案

您的代码中存在两个问题:

There are two problems in your code:


  • 该属性名为 visibility 而不是 visiblity

  • 它不是元素本身的属性,而是 .style 属性。

  • The property is called visibility and not visiblity.
  • It is not a property of the element itself but of its .style property.

这很容易修复。简单替换这个:

It's easy to fix. Simple replace this:

document.getElementById("remember").visiblity

这个:

document.getElementById("remember").style.visibility

这篇关于document.getElementById(&quot; remember&quot;)。visibility =&quot; hidden&quot ;;不在复选框上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆