Theophilus
01-09-2007, 10:46 PM
The following code, designed to give browsers the ability to show or hide answers to faqs by clicking the question, works perfectly in ie7 and opera 9. It doesn't, however, work at all in FireFox 2. Does anyone have any suggestions for how to make it work in FF?
Function definition:
<script>
<!--
//IGNORE THIS PIECE OF CODE
function show_hide(element){
if (eval(element+'.style.display=="none"')){
eval(element+'.style.display=""')
}
else
{
eval(element+'.style.display="none"')
}
}
//-->
</script>
Later on, the actual section to be manipulated:
<a href="javascript:show_hide('whatisaim')">Click here to show or hide the answer to this faq.</a><br>
<div id="whatisaim">
This is where the actual text would go, which would be either hidden or shown, toggling each time the href is clicked.
</div>
At the end of the page, before the closing html tag:
<script>whatisaim.style.display='none';</script>
Of course, these last two parts are repeated for each question.
You can find the actual page here: http://www.aiminternational.org/about/faq.htm
Function definition:
<script>
<!--
//IGNORE THIS PIECE OF CODE
function show_hide(element){
if (eval(element+'.style.display=="none"')){
eval(element+'.style.display=""')
}
else
{
eval(element+'.style.display="none"')
}
}
//-->
</script>
Later on, the actual section to be manipulated:
<a href="javascript:show_hide('whatisaim')">Click here to show or hide the answer to this faq.</a><br>
<div id="whatisaim">
This is where the actual text would go, which would be either hidden or shown, toggling each time the href is clicked.
</div>
At the end of the page, before the closing html tag:
<script>whatisaim.style.display='none';</script>
Of course, these last two parts are repeated for each question.
You can find the actual page here: http://www.aiminternational.org/about/faq.htm