javascript - Click to reveal answer -


updated include more code

our webdesigner has had stroke , i've been trying finalise of design in absence. seems unlikely ever able me.

i've been using typepad , 1 of pages has faqs , uses javascript if click on question answer revealed. if click on answer text disappears again. updated of answer text , seems have broken javascript links somehow. i've been doing tutorials , trying learn how fix it. shows questions , answers , click reveal functionality has been lost.

our designer using onclick = toggle

i have included code (replacing answer text answer 1 brevity) here see if can point out how has been broken/how can fix it. sadly have 0 experience of doing this. thank :)

<p>faq display</p> <script type="text/javascript">// <![cdata[ function toggle(info) { var cstate = document.getelementbyid(info); cstate.style.display = (cstate.style.display != 'block')                    ? 'block' : 'none';} // ]]></script> <div><strong>click on question reveal answer!</strong><br /><br /></div> <h3>services</h3> <div class="faq" onclick="toggle('faq17')"><strong>why use service?   </strong> <div id="faq17" class="faa">answer 17.</div> </div> <div class="faq" onclick="toggle('faq1')"><strong>how cleaning , labelling service cost?</strong> <div id="faq1" class="faa">answer 1.</div> </div> <div class="faq" onclick="toggle('faq2')"><strong>how book service?   </strong> <div id="faq2" class="faa">answer 2.</div> </div> <div class="faq" onclick="toggle('faq3')"><strong>how long service take?</strong> <div id="faq3" class="faa">answer 3.</div> </div> <div class="faq" onclick="toggle('faq4')"><strong>is there minimum number of residents required visit facility?</strong> <div id="faq4" class="faa">answer 4.</div> </div> <h3>diy kits</h3> <div class="faq" onclick="toggle('faq5')"><strong>where can purchase kit from?</strong> <div id="faq5" class="faa">answer 5.</div> </div> <div class="faq" onclick="toggle('faq6')"><strong>how diy kit cost?</strong> <div id="faq6" class="faa">answer 6.</div> </div> <div class="faq" onclick="toggle('faq7')"><strong>how long kit last?    </strong> <div id="faq7" class="faa">answer 7.</div> </div> <div class="faq" onclick="toggle('faq8')"><strong>do kits expire?</strong> <div id="faq8" class="faa">answer 8.</div> </div> <div class="faq" onclick="toggle('faq9')"><strong>is there material data safety sheet (sds) kits?</strong> <div id="faq9" class="faa">answer 9.&nbsp; <span class="asset  asset-generic at-xid-6a01b7c6f66688970b01bb088843a0970d img-responsive"><a href="http://www.identoz.com.au/files/sds-identoz-denture-marking-sealant-version-1.0.pdf">download sds identoz denture marking sealant version 1.0</a>   </span></div> </div> <h3>generic questions</h3> <div class="faq" onclick="toggle('faq10')"><strong>where label placed on denture?</strong> <div id="faq10" class="faa">answer 10.</div> </div> <div class="faq" onclick="toggle('faq11')"><strong>do service areas?   </strong> <div id="faq11" class="faa">answer 11.</div> </div> <div class="faq" onclick="toggle('faq12')"><strong>how make payment?    </strong> <div id="faq12" class="faa">answer 12.</div> </div> <div class="faq" onclick="toggle('faq13')"><strong>are our staff police checked?</strong> <div id="faq13" class="faa">answer 13.</div> </div> <div class="faq" onclick="toggle('faq14')"><strong>is work guaranteed?</strong> <div id="faq14" class="faa">answer 14.</div> </div> <div class="faq" onclick="toggle('faq15')"><strong>do repair dentures? </strong> <div id="faq15" class="faa">answer 15.</div> </div> <div class="faq" onclick="toggle('faq16')"><strong>do have insurance?   </strong> <div id="faq16" class="faa">answer 16.</div> </div> <p><hr class="at-page-break" /></p> 

not shore want might work you:

<html><head> <script type="text/javascript"> function displayanswer(){  document.getelementbyid('question').innerhtml = ' //put answer here'} </script>  </head><body>   <h1>press on question answer</h1> <button onclick="displayanswer"><h2 id="question"> //put question here </h2></button> </body></html> 

Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -