- ahmad alhayek

 Computer Science & Information Technology Department Summer Semester 2020/2021 Web Page Application 341 - Internal Lab button

Show transcribed image text

Expert Answerinformation icon

  • Anonymous's Avatar
    <!DOCTYPE html>
    <html>
    
    <script>
            
            function ToCelsius() {
                    var fh = parseInt(document.getElementById("fahrenheitTxt").value);
                    document.getElementById("f2HTxt").value = (5/9) * (fh - 32);
            }
            function ToFahrenheit() {
                    var cel = parseInt(document.getElementById("celsiusTxt").value);
                    document.getElementById("fahSpan").innerHTML = (9/5) * cel + 32;
            }
            function Random() {
                    var min = 5, max = 30;
                    var randVal = Math.floor((Math.random() * (max - min)) + min);
                    document.getElementById("randId").innerHTML = randVal;
            }
    </script>
    
    <body>
            Type a temperatre in Fahrenheit : <input type="text" id="fahrenheitTxt"><br><br>
            Type a temperatre in Celsius : <input type="text" id="celsiusTxt"><br><br>
            The Temperature result after Conversion from Fahrenheit to Celsius :  <input type="text" id="f2HTxt"><br><br>
            The Temperature in Fahrenheit : <span id="fahSpan"> </span><br>
            
            <br><br>
            
            <button onclick = "ToCelsius()">ToCelsius</button>
            <button onclick = "ToFahrenheit()">ToFahrenheit</button>
            <button onclick = "Random()">Random(5-30)</button><br><br>
            
            The random number between [5-30] is <span id="randId"> </span><br>
            
            
    </body>
    </html>
    

    Code

    sample.html x <html> 4 <script> 7 9 function ToCelsius() { var fh = parseInt(document.getElementById(fahrenheittxt).value);

    Output

    E c File D: sample.html Type a temperatre in Fahrenheit : 400 Type a temperatre in Celsius : 6 The Temperature result after C

    Comment 

ليست هناك تعليقات:

إرسال تعليق

ahmad alhayek تصميم ahmad alhayek جميع الحقوق محفوظة 2016

صور المظاهر بواسطة sndr. يتم التشغيل بواسطة Blogger.