The onchange option in the drop-down box triggers a text box value change.

Source: Internet
Author: User

 

 

Change the value of the drop-down list to trigger a text box value change or make the value of the text box equal to the value currently selected in the drop-down list. There are usually several methods,

One is to refresh the page with post submitted in form;

One method is to use JS functions. Now we only need one sentence to describe one method.CodeYou can do the following:

 

<Select name = "Sel" onchange = "document. All. bitrate. value = Document. All. Sel. Options [document. All. Sel. selectedindex]. value;">
<Option value = "768"> 768 Kbps </option>
<Option value = "512" selected> 512 kbps </option>
<Option value = "384"> 384 kbps </option>
</SELECT>
<Input name = "bitrate" type = text class = "input" value = "512" size = "8" Title = "bit rate set in the system"> kbps

Http://maie.name/article/26.htm

Note that the above method can be controlled without placing it in the form, and the selected value can be enclosed in brackets with "[document. All. Sel. selectedindex!

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.