Small programs for converting units of square meters, acres, and hectares implemented by javascript, and converting units of javascript

Source: Internet
Author: User

Small programs for converting units of square meters, acres, and hectares implemented by javascript, and converting units of javascript

Javascript converts square meters, acres, and hectares. You can use the url to pass parameters to specify the value of the input box as the value of any medium unit.

The source code is as follows:

<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 


A unit conversion tool written in Javascript

Your program is not difficult, but it is not practical for your teacher. It is easy to make the students abnormal when you do such a job. I wrote the example program below, it is simpler and more practical than the program he requested:

<Script Language = "JavaScript">
Var rate = new Array (0.3048, 1.0936133, 3.7854118, 0.4535924 );
Function cmpl (t, I, o)
{
O. value = rate [parseInt (t)] * parseFloat (I );
}
</Script>

<Form>
<Select name = t onchange = "cmpl (this. form. t. value, this. form. I. value, this. form. o);">
<Option value = 0> feet to meters
<Option value = 1> meters to code
<Option value = 2> gallon to litre
<Option value = 3> lbs to kg
</Select> <br>
Input: <input type = text name = I value = 1 onchange = "cmpl (this. form. t. value, this. form. i. value, this. form. o); "> <br>
Output: <input type = text name = o value = 'select the type and number of inputs to convert to 'readonly> <br>
</Form>

We recommend that you learn this example. It is best not to use the page pop-up mode for input and output during this renewal.

A unit conversion applet compiled by VB

Copy the following code to a text file and rename it to 1.frm. Open and run.
VERSION 5.00:
Begin VB. Form Form1
Caption = "Form1"
ClientHeight = 1, 5040
ClientLeft = 60
ClientTop = 450
ClientWidth = 9450
LinkTopic = "Form1"
ScaleHeight = 5040
ScaleWidth = 9450
StartUpPosition = 3' window default
Begin VB. TextBox Text2
Height = 735
Left = 1, 6840
TabIndex = 7
Text = "0"
Maximum = 2400
Width = 1215
End
Begin VB. TextBox Text1
Height = 735
Left = 1, 4440
TabIndex = 6
Text = "0"
Maximum = 2400
Width = 1215
End
Begin VB. OptionButton Option5
Caption = "converting degrees Celsius and Fahrenheit"
BeginProperty Font
Name = ""
Size = 10.5
Charset = 134
Weight = 400
Underline = 0' False
Italic = 0'false
Strikethrough = 0' False
EndProperty
Height = 375
Left = 1, 1080
TabIndex = 5
Maximum = 3360
Width = 2295
End
Begin VB. OptionButton Option4
Caption = "lbs, KG conversion"
BeginProperty Font
Name = & more... the remaining full text>

Related Article

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.