Updating a text box
Author |
Message |
Blade
|
Posted: Thu Nov 20, 2003 2:36 pm Post subject: Updating a text box |
|
|
with javascript how can i make it so that you use a <select> list, then when you select one of the lists, a text box will update with a number? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Amailer
|
|
|
|
|
Blade
|
Posted: Fri Nov 21, 2003 2:56 pm Post subject: (No subject) |
|
|
hmm... how about this
you have a select box, that has a number of options, beside it there is an empty text box. depending on what you select for the drop-down-menu, a number is placed in the text box.. this must be done without refreashing the page. |
|
|
|
|
|
Amailer
|
Posted: Fri Nov 21, 2003 8:08 pm Post subject: (No subject) |
|
|
asdadsa
this?
code: |
<SCRIPT LANGUAGE="JavaScript">
<!--
function onChange(object) {
var Current = object.selectName.selectedIndex;
object.currentText.value = object.selectName.options[Current].text;
}
//-->
</SCRIPT>
<FORM NAME="formName3" onSubmit="return false;">
<SELECT NAME="selectName" onChange="onChange(this.form)">
<OPTION VALUE="Option 0" SELECTED>Entry 0
<OPTION VALUE="Option 1">Entry 1
<OPTION VALUE="Option 2">Entry 2
<OPTION VALUE="Option 3">Entry 3
<OPTION VALUE="Option 4">Entry 4
<OPTION VALUE="Option 5">Entry 5
</SELECT>
<P>
Text: <INPUT NAME="currentText" TYPE="TEXT" VALUE="">
<P>
</FORM>
<SCRIPT LANGUAGE="JavaScript">
<!--
onChange(document.formName2);
//-->
</SCRIPT>
|
|
|
|
|
|
|
Blade
|
Posted: Sat Nov 22, 2003 2:27 pm Post subject: (No subject) |
|
|
yeah, thats pretty much what i was looking for. thanks |
|
|
|
|
|
|
|