Page is a not externally linkable
matthewamzn - 7:12 pm on Mar 10, 2009 (gmt 0)
<script> This is the affected php code:
I'm making an faq page. When someone clicks on a question I want the answer to appear below it. This is what I've got so far, but it's not changing the style on click:
function displayAnswer($id) {
var status = document.getElementById($id).getAttribute("style");
if (status === "display:none;") {
document.getElementById($id).setAttribute("style","display:block;");
} else {
document.getElementById($id).setAttribute("style","display:none;");
}
}
</script>
echo "<a href='javascript:displayAnswer({$faq[faq_id]});'>{$faq[question]}</a><br/>";
echo "<div id='{$faq[faq_id]}' style='display:none;'>{$faq[answer]}<br/></div>";