URI:
   DIR Return Create A Forum - Home
       ---------------------------------------------------------
       Create A Forum - Support Forums
  HTML https://support.createaforum.com
       ---------------------------------------------------------
       *****************************************************
   DIR Return to: Create a Forum Codes and Support
       *****************************************************
       #Post#: 23698--------------------------------------------------
       Javascript Function
       By: mickjav Date: November 29, 2020, 5:52 am
       ---------------------------------------------------------
       I want to add a function to my forum which I am thinking of
       adding to my footer section
       My problem is i wish to use this for a q/a page hiding and
       showing answers useing the code below
       [code] <button onclick="myFunction()">Click Me</button>
       <div id="myDIV">
       This is my DIV element.
       </div>[/code][/color][/color][code]function myFunction() {
       var x = document.getElementById("myDIV");
       if (x.style.display  === "none") {
       x.style.display = "block";
       } else {
       x.style.display =    "none";
       }
       } [/code][color=mediumblue][color=black]What I am thinking of
       doing but not sure if it will work is alter the call and the
       document.getElementById("myDIV");Like[/color][code] <button
       onclick="myFunction(dv1)">Click Me</button>
       <div id="dv1">
       This is my DIV element.
       </div>[/code]
       And update the function so:
       [code]function myFunction(myDIV) {
       var x = document.getElementById(myDIV);
       if (x.style.display  === "none") {
       x.style.display = "block";
       } else {
       x.style.display =    "none";
       }
       } [/code][color=brown]
       Would this work?
       #Post#: 23699--------------------------------------------------
       Re: Javascript Function
       By: mickjav Date: November 29, 2020, 6:43 am
       ---------------------------------------------------------
       Got this workng with a few minor issues which I'm sure I can
       sort
       #Post#: 23700--------------------------------------------------
       Re: Javascript Function
       By: CreateAForum Date: November 29, 2020, 9:00 am
       ---------------------------------------------------------
       Nice work!
       #Post#: 23701--------------------------------------------------
       Re: Javascript Function
       By: mickjav Date: November 29, 2020, 9:23 am
       ---------------------------------------------------------
       Just in case anybody else wants to do something like this you
       can use the below
       Add this function to your Footer section Style Manager->Headers
       and footers
       [code]<script type="text/javascript">
       <!--
       function toggle_visibility(id) {
       var e = document.getElementById(id);
       if(e.style.display == 'block')
       e.style.display = 'none';
       else
       e.style.display = 'block';
       }
       //-->
       </script>[/code]
       Past this into a page to see it work
       [code]<div class="cat_bar">
       <h3 class="catbg centertext" style="text-align: left;"><span
       style="font-size: small;" title="Click to view answer"
       onclick="toggle_visibility('DD0')">What software do you use to
       build database's
       </span></h3>
       </div>
       <div id="DD0" style="display: none; text-align: left;">We use
       Microsoft Access for all our database's, We have also worked
       with mysql, PHP and Visual Basic</div>[/code]P.S One thing I
       itend doing is making the click text look like a link
       *****************************************************