this is your table having text fields:
<table width="291" id="prl" style="display:none">
<tr>
<td width="95">message</td>
<td width="196"><input name="message" type="text" id="message" ></td>
</tr>
<tr>
<td>name</td>
<td><input name="name" type="text" id="name"></td>
</tr>
</table>
this is your link to show the text boxes:
<a href="#" onClick="toggle_it('prl')">show</a>
include this script in your page:
<script language="javascript">
function toggle_it(itemID){
// Toggle visibility between none and inline
if ((document.getElementById(itemID).style.display == 'none'))
{
document.getElementById(itemID).style.display = 'inline';
} else {
document.getElementById(itemID).style.display = 'none';
}
}
</script>
Shanti C
Posting Virtuoso
1,642 posts since Jul 2008
Reputation Points: 137
Solved Threads: 162
What is the need of javascript code ....
the table will show after clicks on the show hyperlink:
<a href="#" onClick="toggle_it('prl')">show</a>
all this is done by javascript....
Shanti C
Posting Virtuoso
1,642 posts since Jul 2008
Reputation Points: 137
Solved Threads: 162
This is a fundamental HTML error.
The div tag cannot have the table tag or the tr tag as its parent. It must be either outside the table, or inside a td tag. And the only legal parent of a td tag is a tr tag.
Also, note that some browsers have trouble displaying a structure later, if it is initially not displayed.
MidiMagic
Nearly a Senior Poster
3,319 posts since Jan 2007
Reputation Points: 730
Solved Threads: 182
Well spotted Midi.
One thing that should also be pointed out is that Javascript should not be used for site functionality. If someone doesn't have JS enabled (a number of companies have it disabled on all employee computers), then they won't be able to use the form.
If you "must" hide the table, then consider using CSS's visibility attribute.
rexibit
Junior Poster in Training
55 posts since Jun 2008
Reputation Points: 15
Solved Threads: 4