mardi 10 février 2015

JavaScript function in href Hide/dispaly


Is it possible click the same link to hide and display coy below? This is what I have so far. I was able to create a javascript to display copy but I couldn't figure out how to click the same link to hide it. I have basic knowledge of html. This is the code that I am using



<p>
<strong>
<a href="javascript:;" onclick="document.getElementById('text1').style.display='block';">
Gifts that Don't Impact your Lifestyle
</a>
</strong>
<div id="text1" style="display: none; margin-top: 2px;">
There are many ways to give a gift to without impacting your lifestyle.
</div>
</p>
<p>
<strong>
<a href="javascript:;" onclick="document.getElementById('text2').style.display='block';">
Gifts that Increase your Income
</a>
</strong>
</p>
<div id="text2" style="display: none;">
You can enhance your income while supporting a Charitable Gift Annuity or Charitable Remainder Trust.
</div>
<p>
<strong>
<a href="javascript:;" onclick="document.getElementById('text3').style.display='block';">
Gifts that Provide for your Heirs
</a>
</strong>
<div id="text3" style="display: none;">
You can pass assets to your family on a tax favorable basis while providing immediate support.
</div>
</p>




Aucun commentaire:

Enregistrer un commentaire