Expanding link?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
xEzMikex
Forum Commoner
Posts: 38
Joined: Sat Jan 21, 2006 10:18 pm
Location: Canada

Expanding link?

Post 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?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Moved to Client-Side.
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

It would be javascript. Search for showing and hidding info.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

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