Javascript onclick event working to show but not to hide

Gertz

New Member
It's a pretty basic script, but basically im displaying a div on click, and then hiding then div when you click a button title later. i have done this before and it has worked flawlessly. I just cant seem to find out what i did wrong, or am doing wrong. Like i said, the first \[code\]click()\[/code\] displays perfectly, the second \[code\]hide()\[/code\] does nothingJS:\[code\]function click1(){ document.getElementById('form1').style.display='block';}function hide1(){ document.getElementById('form1').style.display='none';}\[/code\]HTML:\[code\]<tbody> <tr> <td style="cursor:pointer;" onclick="click1()"> <div id="form1" style="display:none;"> <form action="enter.php" method="post"> <label for="entry1">Entry1</label> <input type="text" id="entry1" name="entry1" size="15" /><br> <label for="entry2">Entry2</label> <input type="text" id="entry2" name="entry2" size="15"/><br> <label for="entry3">Entry3</label> <input type="text" id="entry3" name="entry3" size="15"/><br> <input type="hidden" name="id" value="http://stackoverflow.com/questions/14433585/1" /><br> <input type="hidden" name="table" value="http://stackoverflow.com/questions/14433585/table" /><br> <input type="submit" value="http://stackoverflow.com/questions/14433585/GO!" /> <input type="button" value="http://stackoverflow.com/questions/14433585/later" onClick="hide1()"/> </form> </div><sub>1</sub> </td> </tr></tbody>\[/code\]
 
Back
Top