PDA

View Full Version : Make a form submit button appear


paladaxar
03-02-2006, 02:29 PM
Ok...this is kicking my butt. I need to make a button appear after a selection is made on a selection list. There are actually three lists. When a selection is made on the first, the second appears. When a selection is made on the second list, a third appears. When a selection is made on the third, I want a submit button to appear. I cant get it to work.

:newbie:

I'm using this to make the selection boxes appear:


function selection(selected)
document.the_form.african_countries.style.visibility= 'visible';

<select name="contenent" id='first' size="10">
<option value='africa' onclick="selection('africa')">Africa ></option>
<option value='asia' onclick="selection('asia')">Asia ></option>
<option value='europe' onclick="selection('europe')">Europe ></option>
</select>

What would I use to make a button appear?

greatguns
03-02-2006, 03:14 PM
function selection(selected)
document.the_form.african_countries.style.visibility= 'visible';

<select name="contenent" size="10" onchange="Selection(this.value)">
<option value='africa' >Africa ></option>
<option value='asia' >Asia ></option>
<option value='europe' >Europe ></option>
</select>

Hope That helps :)

paladaxar
03-02-2006, 04:03 PM
actually...no...that doesnt help. I know that it is possible to re-write that function. Also, the entire function is not listed. That wasnt the point. The point is, what do I write to make a button appear? instead of a selection list?

<input type='submit' name='the_button' value='input it'>
document.the_form.the_button.visibility='visible' ???

this doesnt work. I need something else, but I dont know what.

greatguns
03-02-2006, 04:22 PM
to make elements appear use the style.display.

element.style.display="inline"; ---to make any element appear
element.style.display="none"; --to make it disappear

paladaxar
03-02-2006, 04:43 PM
wow...I'm an idiot...

I needed this:

document.the_form.the_button.STYLE.visibility= 'visible';

By the way, why do you reccomend using style.display instead of style.visibility?

I'm pretty new to css.

greatguns
03-02-2006, 05:01 PM
.visibility just hides or unhides the element, the space is allocated to it even when the element is hidden.

but display removes the element when it is made to hide.

em pretty new to CSS too.....just learned the difference to today :D

paladaxar
03-02-2006, 06:06 PM
if you use "position: absolute;" a space is not allocated. Thanks for the info though, I'll play around with both and see which i like better.