Avatar of fjkilken
fjkilken asked on

Need DIV hidden on page load

HI, I have some code (below) which works perfectly to show/hide a DIV, the only issue is that the DIV is visible when the page is loaded, clicking the button unhides the DIV.
I would like the opposite:
I want the DIV hidden when someone visits the webpage, then when they click the button I want the DIV to be visible - thanks

<script language="JavaScript">
      function toggle(id) {
            var state = document.getElementById(id).style.display;
            if (state == 'none') {
                  document.getElementById(id).style.display = 'block';
            } else {
                  document.getElementById(id).style.display = 'none';
            }
      }
</script>


 <input name="btn_show_dir_map" type="button" value="Click to show directions map"
                         onclick=" toggle('race_directions_map'); return false"/>
<DIV ID="race_directions_map" NAME="race_directions_map">
<IFRAME ID="iframe_race_directions_map" CLASS="InlineBdr" WIDTH="800" HEIGHT="600" BORDER="0" FRAMEBORDER="no"
                                    src="http://maps.google.com/maps?saddr=newry,+co.down&daddr=53.1554634861,-6.18778650738+(%22Djouce+Wood+carpark%22)&ie=UTF8&v=2.2&cv=4.2.0198.2451&hl=en&ll=53.666745,-6.285015&spn=1.493813,2.504883&z=8" style="color:#0000FF;text-align:left">
                              </IFRAME>
                        </DIV>
JavaScript

Avatar of undefined
Last Comment
fjkilken

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Pawel Witkowski

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
fjkilken

perfect - so simple, but perfect!!
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck