首页 \ 问答 \ 如何使用javascript通过id隐藏html div(how to hide an html div by id using javascript)

如何使用javascript通过id隐藏html div(how to hide an html div by id using javascript)

我试图用Javascript隐藏HTML div并且收到错误

JavaScript运行时错误:无法获取未定义或空引用的属性“样式”

这是我的JavaScript代码:

if (typeof(jsondata[0]) == 'undefined') {
    alert('should be hidden');
    document.getElementById("unassignedDevices").style.visibility = "hidden";
}

这是我的HTML:

<div id="unassignedDevices">
    <button id="unassignedDevicesbutton" class="button-basicmenu" onclick="findUnassignedDevices();">Find unassigned Devices</button>

    <table id="gridunassignedDevices"></table>

</div>

因此,当我开始调试时,页面警报'应该被隐藏'然后我得到JavaScript运行时错误。

我怎么能隐藏这个div?


I am trying to hide an HTML div with Javascript and am getting an error

JavaScript runtime error: Unable to get property 'style' of undefined or null reference

Here is my JavaScript code:

if (typeof(jsondata[0]) == 'undefined') {
    alert('should be hidden');
    document.getElementById("unassignedDevices").style.visibility = "hidden";
}

and here is my HTML:

<div id="unassignedDevices">
    <button id="unassignedDevicesbutton" class="button-basicmenu" onclick="findUnassignedDevices();">Find unassigned Devices</button>

    <table id="gridunassignedDevices"></table>

</div>

So when I start debugging, the page alerts 'should be hidden' and then I get the JavaScript runtime error.

How can I hide this div?


原文:
更新时间:2022-05-21 16:05

最满意答案

它不可能与纯j2me。

我认为,如果您对Symbian OS [和您的目标OS iw symbian]级别编码感到满意,那么请尝试J2ME JNI。


Its not possible with pure j2me.

I think if you are comfortable with Symbian OS [and your targeted OS iw symbian]level coding then try J2ME JNI.

相关问答

更多
  • 要将j2me应用程序设置为背景,请在您的midlet类中使用以下内容: Display.getDisplay (this).setCurrent (null); 让屏幕返回使用以下内容: Display.getDisplay (this).setCurrent (myCanvas); myCanvas是您的画布实例 [R ps您仍然可以使用线程或计时器在隐藏midlet的同时在背景中执行操作。 ps2:这不适用于所有型号。 (适用于Nokia S60,SonyEr ...
  • 无法以编程方式提取通话记录。 首先,Apple正式不公开任何公开的API来访问通话记录。 这意味着你可以破解你想要访问通话记录的所有内容(使用私有API),但是当你向苹果提交你的应用时,它肯定会被拒绝。 关于你提到的应用程序(quickRemainder) 它使用cvs文件或文本文件获取通话记录。 它不通过设备calllog数据库获取信息。 从他们的应用描述中提取。 您可以将包含电话呼叫的文本或CVS文件导入到此应用程序中。 TrueCaller没有得到通话记录,他们只是使用应用程序来搜索联系人并用他们得到 ...
  • 没有办法做到这一点,最好让你的服务器以某种方式终止电话。 No way to do this, best to get your server to terminate the call somehow.
  • 想象一下,不可能在J2me应用程序中获取权限设置,最好也是唯一的解决方案是签署您的应用程序,并在启动时它将要求权限。 Figured it out that it's not possible to get permissions settings inside J2me application, the best and only solution is to SIGN your application and on start it will ask for permissions.
  • 适用于iOS4,但适用于iOS5。 更多信息,包括示例代码http://iosstuff.wordpress.com/2011/08/19/accessing-iphone-call-history/ iTunes(calLog)中至少有一个应用程序,似乎已经实现了这一点。 也许这就是为什么Apple在iOS5中禁用它... Yes for iOS4, but no for iOS5. More info here, including sample code http://iosstuff.wordpre ...
  • 这里是我的RMS的库代码,只是研究它,它很容易实现,像插入,更新,删除的所有方法都在那里。 import javax.microedition.rms.RecordEnumeration; import javax.microedition.rms.RecordStore; import javax.microedition.rms.RecordStoreFullException; import javax.microedition.rms.RecordStoreNotOpenException; imp ...
  • 尝试增加允许的堆空间 检查调优JVM切换器的性能 调优eclipse有一个很好的线程: Eclipse 3.4中最好的JVM设置是什么? 其中一些可能对你有用 Try increaing the allowed heap space Check Tuning JVM switches for performance There is a good thread for tuning eclipse: What are the best JVM settings for Eclipse 3.4? Some o ...
  • 每个Blackberry OS都有API参考。 例4.5 (只需将版本号更改为4.7或任何其他版本)。 但是你可以在Research in Motion 的开发者网站上找到很多资源。 我个人使用eclipse插件作为IDE。 There is the API Reference for every Blackberry OS. Example 4.5 (just change the Version number to 4.7 or any other version). But you can find ...
  • 两个应用程序版本都有不同的启动方式,对吧? 有一次它是一个MIDlet,另一次是带有静态main方法的Java类。 在那种情况下,我没有看到使用预处理的要求。 两个启动实现都可以访问公共代码库并移交J2ME或J2SE“graphics”对象,该对象实现公共代码库已知的接口。 这样公共代码库不需要知道实现细节,只需要表示部分的接口。 BTW ..前段时间我有类似的情况,我觉得设置3个Eclipse项目,J2ME,J2SE和一个通用逻辑项目(技术上也是一个J2ME项目)更为舒服。 这有助于防止仅J2ME- / ...
  • 它不可能与纯j2me。 我认为,如果您对Symbian OS [和您的目标OS iw symbian]级别编码感到满意,那么请尝试J2ME JNI。 Its not possible with pure j2me. I think if you are comfortable with Symbian OS [and your targeted OS iw symbian]level coding then try J2ME JNI.

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。