Page 1 of 1

Expanding link?

Posted: Mon Feb 06, 2006 10:01 pm
by xEzMikex
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?

Posted: Mon Feb 06, 2006 10:05 pm
by John Cartwright
Moved to Client-Side.

Posted: Mon Feb 06, 2006 11:27 pm
by nickman013
It would be javascript. Search for showing and hidding info.

Posted: Tue Feb 07, 2006 7:38 am
by Chris Corbyn
DOM scripting ;)

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>
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) ;)