Categories

Tools

bitdefender

1&1 Web Hosting

A simple Javascript function to convert a number from decimal system in hexadecimal system


Code:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>A simple Javascript function to convert a number from decimal system in hexadecimal system - MdmSoft</title>

    <script type="text/javascript">
        function PrintHexValue( min, max ) {
            for (j = min; j <= max; j++)
            {
                var dec = j;
                var hex = dec.toString(16).toUpperCase();

                document.write("Dec: " + dec + " > Hex: " + hex);
                document.write("<br />");
            }
        }
    </script>
</head>
<body onload="javascript:PrintHexValue(32, 42);">
    <h1 class="title">Convert a number from decimal system in hexadecimal system</h1>
    <div>

    </div>
</body>
</html>

Result:

Dec: 32 > Hex: 20
Dec: 33 > Hex: 21
Dec: 34 > Hex: 22
Dec: 35 > Hex: 23
Dec: 36 > Hex: 24
Dec: 37 > Hex: 25
Dec: 38 > Hex: 26
Dec: 39 > Hex: 27
Dec: 40 > Hex: 28
Dec: 41 > Hex: 29
Dec: 42 > Hex: 2A

Posted in Javascript by MdmSoft

If our work has been of help, you can help us with a small donation...
Our programmers will thank you!



All information contained in this web site are the property of MdmSoft. The information is provided "as is", MdmSoft will not be liable for any misuse of the code contained in these pages, nor can it be for inaccuracies, grammatical errors or other factors that may have caused damage or lost earnings. MdmSoft is not responsible for the content of comments posted by users.
The examples in this area have the educational and demonstration purposes only, and may be copied only for your reference, but cannot be used for commercial purposes, or for any other purpose, without the express written consent of MdmSoft.
MdmSoft also reserves the right to change, without notice, to your liking this web site, the pages and its sections, and may suspend temporarily or definitely the various services included on this site.
While using this site, you agree to have read and accepted our Terms of Service and Privacy Policy.