Expanding link?
Moderator: General Moderators
Expanding link?
Allright well for my admin panel im making somthing like Invision Power board's admin center. im wondering how to make it so lets say if theres a link when i click it a form pops up under the text. how would i go abouts doing this?
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
- nickman013
- Forum Regular
- Posts: 764
- Joined: Sun Aug 14, 2005 12:02 am
- Location: Long Island, New York
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
DOM scripting 
The simple way (toggling an element's visibility)....
If you need to physically create the form on-the-fly then that's more advanced but you'd want to look at document.createElement() and elNode1.appendChild(elNode2) 
The simple way (toggling an element's visibility)....
Code: Select all
<script type="text/javascript">
<!-- Hidey hidey
function toggleVis(where)
{
el = document.getElementById(where);
if (el.style.height == '0')
{
el.style.height = '';
}
else
{
el.style.height = 0;
}
return false;
}
// -->
</script>
<a href="javascript:toggleVis('foo');">Search now</a>
<div id="foo" style="height: 0;">
<form ... >
<input type="text" name="searchval" /> <input type="submit" name="submit" value="Search" />
</form>
</div>