469,647 Members | 1,825 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,647 developers. It's quick & easy.

Adaptive forms

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

Apr 27 '07 #1
1 1309
On Apr 27, 11:40 am, Damo <cormacdeba...@gmail.comwrote:
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'
}
Apr 28 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Joshua Russell | last post: by
3 posts views Thread by M D | last post: by
4 posts views Thread by Nacho Nachev | last post: by
3 posts views Thread by Lloyd Sheen | last post: by
3 posts views Thread by Geraldine Hobley | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.