Two Selcect form value calculation methods

Source: Internet
Author: User
I have been a little busy over the past few days. Today I have studied the method of using select form values for operations. I feel that the JS version is not a new thing, but I haven't seen anyone in the PHP version, so we can write it out together and remove the grass by the way. I wrote it while eating. After I finished writing it, I went out. I have no time to read comments one by one recently. I have to wait for my status.

I have been a little busy over the past few days. Today I have studied the method of using select form values for operations. I feel that the JS version is not a new thing, but I haven't seen anyone in the PHP version, so we can write it out together and remove the grass by the way. I wrote it while eating. After I finished writing it, I went out. I have no time to read comments one by one recently. I have to wait for my status.

I have been a little busy over the past few days. Today I have studied the method of using select form values for operations. I feel that the JS version is not a new thing, but I haven't seen anyone in the PHP version, so we can write it out together and remove the grass by the way.
I wrote it while eating. After I finished writing it, I went out. I have no time to read comments one by one recently, I have to wait until I get better.
I hope you miss me so deeply.

PHP Method

PHP needs to pass$ _ POSTObtain the value passed by the form submission. Therefore, you must click the button to submit the value before performing the operation,

 

The effect is as follows:

JS Method

The JS method does not need to refresh the page and displays the results in real time.

Script function getResult () {var number = document. formJs. xhdSelect. value; // obtain the select value document. getElementById ("result "). innerHTML = number * 2; // rewrite the element to display the operation result} script

The effect is as follows:

Original article address: Two Methods of Selcect form value calculation, thanks to the original author for sharing.

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.