单击千克按钮,在javascript中将克转换为千克

时间:2017-03-27 03:45:02

标签: javascript html

Input Grams(g):
    <input type="text" name="grams" id="grams"><br>
    <br>
    <button type="button" onclick="kilo()">Kilogram</button>
    <p id="convert"></p>
    <script type="text/javascript">
        function kilo(){

        }

2 个答案:

答案 0 :(得分:1)

Input Grams(g): <input type="text" name="grams" id="grams">
<br>
Results: <p id="convert"></p>

<button onclick="kilo()">Kilogram</button>

<script type="text/javascript">

    function kilo() {
        document.getElementById('convert').innerHTML =
            (document.getElementById('grams').value/1000 + "kg");
    }

</script>

答案 1 :(得分:0)

1. Keep only bad price and good price in response AND extract Original item manufacturer, year of manufacturing, city of purchase from input query string to API from client.