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.
hiding a form, in the style of a drop-down menu?
-
- Posts: 54
- Joined: Fri Feb 19, 2010 6:37 am
hiding a form, in the style of a drop-down menu?
Easy to play - hard to survive. http://www.ageoffable.net
Re: hiding a form, in the style of a drop-down menu?
If you made a div there is a option that you can have set the visibility Check it out here
hope this helps
-KunoNoOni
hope this helps

-KunoNoOni
Re: hiding a form, in the style of a drop-down menu?
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.
- PaxBritannia
- Posts: 680
- Joined: Sun Apr 18, 2010 1:54 pm
Re: hiding a form, in the style of a drop-down menu?
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.
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.
- 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?
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.
There are many options to do this, Chris has a very good one with make it visible and invisible.
-
- Posts: 54
- Joined: Fri Feb 19, 2010 6:37 am
Re: hiding a form, in the style of a drop-down menu?
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")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
Easy to play - hard to survive. http://www.ageoffable.net
-
- Posts: 54
- Joined: Fri Feb 19, 2010 6:37 am
Re: hiding a form, in the style of a drop-down menu?
Thanks.
Easy to play - hard to survive. http://www.ageoffable.net