JavaScriptは、平方メートル、MU、ユニット変換のヘクタールを実装します。パラメーターをURLに渡して、入力ボックスの値がユニット内の任意のユニットの値であることを指定できます。
ソースコードは次のとおりです。
< xmlns = "http://www.w3.org/1999/xhtml"> <head> <meta http-equiv = "content-type" content = "text/html; charset = utf-8"/> <title> mini-mega、mu、head conspret emforment by javascript onChange = "SelectChange(this)" id = "sel"> <option value = "hectare"> hectare </option> <option value = "mu"> mu </option> <option値= "square meter">平方メートル</option> </select> type = "text/javascript"> var a = parseint( '0'); ////ここに動的に受け取る値への変更があります。 0はユニットが平方メートル、1はエーカー、2はヘクタールvar sel = document.getElementById( 'sel'); sel.SelectedIndex = 2 -a; ///// //現在のユニットを記録するvar input = document.getElementById( "input0"); // 10000平方メートル= 15 mu = 1ヘクタールのvar frate = {//変換レートヘクタール:{mu:15、平方メートル:10000}、mu:{平方メートル:10000 /15、ヘクタール:1 /15}、平方メートル:{mu:15 /10000、hectares:1 /10000}}; function selectchange(obj){//単位の変更、変換var v = parsefloat(input.value); //元の値を取得し、変換してください、フレートの値に注意を払って、最後のユニットノードを取得し、現在のユニットvar rst =(v * frate [lastunit] [sel.balue] = rst(4)。 lastunit = sel.value; //現在のユニット変数を更新} </script> </body> </html>