Javascript 如何基于另一个DIV内容的可见性显示DIV内容

Javascript 如何基于另一个DIV内容的可见性显示DIV内容,javascript,html,button,visibility,Javascript,Html,Button,Visibility,我将以下DIV元素一起显示在一个页面上: <div><a href="javascript:;" id="awesome-button" style="visibility:hidden">This Link Shows Up First</a></div> <div style="display:none; id:showUpAfterAwesomeButtonIsClicked;"><a href="javascript:;

我将以下DIV元素一起显示在一个页面上:

<div><a href="javascript:;" id="awesome-button" style="visibility:hidden">This Link Shows Up First</a></div>

<div style="display:none; id:showUpAfterAwesomeButtonIsClicked;"><a href="javascript:;" onclick="someFunction();">This is the value that should show up after the link above is clicked.</a></div>
我已经测试了这个脚本,当用户单击链接时,它成功地将
显示按钮单击后的状态更改为隐藏。这使我相信,需要更新的连接与以下线路有关:

document.getElementById(“单击某个按钮后显示”).style.display=''


我试过这一行的几种变体。有没有更好的方法来实现这一结果?谢谢。

您不能在CSS中设置id属性。它实际上需要是xml标记上的一个属性。 改变




这将允许您的document.getElementById实际选择它。

谢谢,这样更有意义。如您所述,我尝试调整
id
值,但
显示没有改变。我应该为此编写一个单独的javascript函数吗?明白了!我不得不对剧本做了一些调整,但你的回答肯定为我指明了正确的方向,所以我要获奖。非常感谢:)
custom.valueAwesome = function() {
var awesomeButton = document.getElementById('awesome-button');
awesomeButton.style.visibility = 'hidden';
document.getElementById("showUpAfterAwesomeButtonIsClicked").style.display = '';
gadash.executeCommandQueue();
};
<div style="display:none; id:showUpAfterAwesomeButtonIsClicked;">
<div id="showUpAfterAwesomeButtonIsClicked" style="display:none; ">