I have a simple function to toggle visibility of whatever. I use it in many places and I know it works fine.
<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>
I'm now using this in a program and it's not working at all.
$id = "add_more_q";
?>
<div><font color='blue'><a onlick='toggle_visibility("<?php echo $id; ?>")'>Add More Questions</a></font></div>
<div id='<?php echo $id;?>' style='display: none'>
<?php
$form->form_ddbox("Add Question Two",'',$add_question_array,$errors,1,0,0);
//so on...
echo "</div>";
form_ddbox creates a drop down box taking an array and the name and other stuff.
The only difference between this program any any previous pages where I used the java function is that this one is inside of <form> tags. Does java not work inside <form>? I am so confused by this. I literally copy and pasted code and it all of a sudden doesn't work.