Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Pass value to checkbox

How to pass a value from Drop-down to Textbox... by GUJUm0deL
Posted: 11 Jun 02

Hiya, folks...this script will pass a value from the drop-down select box to the textbox...
  This can be done two ways:  one is via the onClick even handler in the <form> tag and the other is in the <input button> tag...
  The diff. is, the first way (<form> way) will pass the value as soon as the value is selected, while the later version (<input button> way) will only pass it after the user hits the button...

  This is the <form> way:

<title>Drop DOwn and Textbox</title>

<script language="javascript">
function displ()
  if(document.myFORM.valu.options[0].value == true) {
    return false
  else {
  return true;


<body bgcolor="#FFFFFF" text="#000000">
<table border="0" cellspacing="0" cellpadding="0" width="75%">
<td width="100%"><form name="myFORM" onClick="return displ();">
          <select name="valu" size="1">
            <option value>Choose One</option>
            <option value="MT001">MT0001 | Copper Cable Shield 1</option>
            <option value="MT002">MT0002 | Copper Cable Shield 2</option>
            <option value="MT003">MT0003 | Copper Cable Shield 3</option>
          <input type="text" name="textfield">

Back to Javascript FAQ Index
Back to Javascript Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close