PDA

View Full Version : Show/Hide Div



doni49
03-19-2006, 07:21 PM
I've got a form defined inside a DIV. When the page first loads this DIV is hidden and then when a particular button is clicked, the div (and more importantly the form) is supposed to be shown. But when the button is clicked the div doesn't show up.

This is the code I'm using to try and show the div (it's part of a function that runs with an onclick event from one of my buttons--I've confirmed that function IS running when I click the button):


document.getElementById("frm").style.display="block";


This is the XHTML code that builds my div:


<div name="frm" style="display:none"><br>Hello!<br><form name="f1"><table>
<tr><td colspan="3">Click on an item in either field list to see the purpose/meaning of each.</td></tr>
<!-- <tr><td><input type="textarea" name="t1"</td></tr> -->
<tr>
<td valign="top">
<select name=IdxAvailable size="10" onchange="changetext(fldNames[this.options[this.selectedIndex].value])">
<!-- javascript function will build this select list -->
</select>
</td>
<td valign="center">
<input type="button" onclick="addItem()" value="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Add >&nbsp;&nbsp;&nbsp;&nbsp;"><br>
<input type="button" value="< Remove" onclick="removeItem()">

</td>
<td valign="top">
<select name="IdxUsed" size="9" onchange="changetext(fldNames[this.options[this.selectedIndex].value])"> -->
<!-- javascript function will build this select list -->
</select><br>
<input type="button" value="Move Up" name="MoveUp" onclick="moveUp()"><input type="button" value="MoveDn" name="Move Down" onclick="moveDn()">
</td>
<td>&nbsp;</td>
<td width="500" valign="top">
<ilayer id="d1" width="200" height="200" visibility="hide">
<layer id="d2" width="200" height="200">
<div id="descriptions" align="left">

<!-- javascript function add text here -->

</div>
</layer>
</ilayer>
</td>
</tr>
<tr>
</tr>
</table></form> </div>

Twey
03-19-2006, 07:53 PM
<div name="frm"

document.getElementById("frm")Notice anything?