[英]Show/Hide DIV control with buttons
I have a menu bar that I want to control the visibility of DIV's featuring varied content. 我有一个菜单栏,我想控制DIV的各种内容的可见性。 Currently the DIV's visiblity and invisibility is controlled but clicking on the same button.
目前,DIV的可见性和隐形性受到控制,但点击相同的按钮。 What I want to do is enable any button selected in the menu to make the previous DIV invisible and replace it with the selected DIV's visibility.
我想要做的是启用菜单中选择的任何按钮,使之前的DIV不可见,并将其替换为所选DIV的可见性。
Is this possible??? 这可能吗??? The script that I'm using to call up the DIV is as follows:
我用来调用DIV的脚本如下:
<"javascript:unhide('unique DIV id goes here');">
Any help appreciated! 任何帮助赞赏! Thanks!
谢谢!
I think you need the display
property. 我认为你需要
display
属性。 Some general stuff: 一些一般的东西:
visibility: hidden \\ visible
visibility: hidden \\ visible
display: none \\ block
display: none \\ block
The difference is that in display
the element stops taking up space in the page, and in visibility
they do take space, but you don't see them. 不同之处在于,在
display
,元素会停止占用页面中的空间,而在visibility
它们会占用空间,但您看不到它们。
So try this: 试试这个:
function unhide(id){
document.getElementById(id).display = 'none';
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.