472,145 Members | 1,639 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,145 software developers and data experts.

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 1354
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 Saiars | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.