Adaptive forms

D

Damo

Hi
I'm new to javascript and been forced to jump in at the deep end(at
least this feels like the deep end to me!).

I need a form with two buttons, and when one of the buttons is pressed
it displays a text box, like so.



<form method = "POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">

<button type="submit">Show Text Field</button><br>

<button type="submit">Submit</button>
</form>

How do i go about implementing this in JavaScript?
thanks
 
S

scripts.contact

Hi
I'm new to javascript and been forced to jump in at the deep end(at
least this feels like the deep end to me!).

I need a form with two buttons, and when one of the buttons is pressed
it displays a text box, like so.

<form ... >
<button type="button" onclick="showFi(this.form)">Show Text Field</
button><br>
<input type="text" name=extra size=40 style="display:none"><br>
<button type="submit">Submit</button>
</form>

and this function in script :
function showFi(form){
var style=form.extra.style
style.display=style.display=='none'?'':'none'
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top