hiding a form, in the style of a drop-down menu?

C++, C#, Java, PHP, ect...
Post Reply
Age of Fable
Posts: 54
Joined: Fri Feb 19, 2010 6:37 am

hiding a form, in the style of a drop-down menu?

Post by Age of Fable »

In my game I have a form, which is used if the player wants to gamble. It lets them enter the details (how much to bet, how many bets etc).

I want to have a link, eg "adjust gambling" which, if it's clicked, will make the form come up (and if pressed again will make it disappear).

I could obviously do it as a link or have a popup window, but I was wanting to have it on the same page.

I found some javascript which does similar menus, but it turns every line into a link, so it wouldn't work for the form.
Easy to play - hard to survive. http://www.ageoffable.net
User avatar
KunoNoOni
Posts: 61
Joined: Sun May 09, 2010 1:54 am

Re: hiding a form, in the style of a drop-down menu?

Post by KunoNoOni »

If you made a div there is a option that you can have set the visibility Check it out here

hope this helps :)

-KunoNoOni
User avatar
Chris
Posts: 1581
Joined: Wed Sep 30, 2009 7:22 pm

Re: hiding a form, in the style of a drop-down menu?

Post by Chris »

Code: Select all

<a href="javascript: document.getElementById('hiddenDiv').style.visibility='visible'; void 0;">Show div</a>

<div id="hiddenDiv" style="visibility: hidden; height: 200px; width: 200px; border: #000 1px solid; padding: 20px;">
    <a href="javascript: document.getElementById('hiddenDiv').style.visibility='hidden'; void 0;">Hide div</a>
</div>
Fighting for peace is declaring war on war. If you want peace be peaceful.
User avatar
PaxBritannia
Posts: 680
Joined: Sun Apr 18, 2010 1:54 pm

Re: hiding a form, in the style of a drop-down menu?

Post by PaxBritannia »

If I understand correctly:

There is a form.
But if a player wants to alter the settings "e.a. adjust gambling", he clicks a link, and then a form appears, the form being on the same page (not a pop up). The player then enter the stuff into the form and presses "submit/return/etc."He then returns to the initial form.

When he then submits this initial form, both sets of info from both forms are submitted.

If it is, that would need javascript. It should be easy. But I don't have time to do write an example now, I have an assignment due tomorrow. :|

Pax.
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: hiding a form, in the style of a drop-down menu?

Post by hallsofvallhalla »

why would it turn every line into a link?? you can just </a> where you want the link to stop. Maybe I am not understanding what you mean by that.

There are many options to do this, Chris has a very good one with make it visible and invisible.
Age of Fable
Posts: 54
Joined: Fri Feb 19, 2010 6:37 am

Re: hiding a form, in the style of a drop-down menu?

Post by Age of Fable »

KunoNoOni wrote:If you made a div there is a option that you can have set the visibility Check it out here

hope this helps :)

-KunoNoOni
I wanted something similar to this, except the user can click the paragraph on and off (ie there's a heading which says, for example, "show form" or "hide form")
Easy to play - hard to survive. http://www.ageoffable.net
User avatar
Noctrine
Posts: 928
Joined: Thu Apr 23, 2009 9:57 pm

Re: hiding a form, in the style of a drop-down menu?

Post by Noctrine »

Jesse Dorsey
ProjectANI - Lead Developer Person
http://about.me/jessedorsey
Age of Fable
Posts: 54
Joined: Fri Feb 19, 2010 6:37 am

Re: hiding a form, in the style of a drop-down menu?

Post by Age of Fable »

Thanks.
Easy to play - hard to survive. http://www.ageoffable.net
Post Reply

Return to “Coding”