<!DOCTYPE html>
<html>
<head>
    <title>Cryptocurrency Price</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<body>
    <h1>Cryptocurrency Price</h1>
    <table>
        <thead>
            <tr>
                <th>Cryptocurrency</th>
                <th>Price (USD)</th>
                <th>Price (BTC)</th>
            </tr>
        </thead>
        <tbody id="crypto-table">
        </tbody>
    </table>

    <script>
        // Fetch cryptocurrency data from CoinGecko API
        $.getJSON('https://api.coingecko.com/api/v3/simple/price?ids=bitcoin,ethereum,litecoin&vs_currencies=usd,btc', function(data) {
            // Display cryptocurrency prices in the table
            $('#crypto-table').append('<tr><td>Bitcoin</td><td>' + data.bitcoin.usd + '</td><td>' + data.bitcoin.btc + '</td></tr>');
            $('#crypto-table').append('<tr><td>Ethereum</td><td>' + data.ethereum.usd + '</td><td>' + data.ethereum.btc + '</td></tr>');
            $('#crypto-table').append('<tr><td>Litecoin</td><td>' + data.litecoin.usd + '</td><td>' + data.litecoin.btc + '</td></tr>');
        });
    </script>
</body>
</html>

This code will display the current prices of Bitcoin, Ethereum, and Litecoin in both USD and BTC. You can modify the code to include additional cryptocurrencies or customize the table as per your requirements.

Remember to replace the <title> tag and the <h1> tag with your desired title for the page. Additionally, you can style the table using CSS to make it visually appealing.

I hope this helps! Let me know if you have any more questions. 😄👍

December 9, 2023 5:26 PM

إرسال تعليق

0 تعليقات