JJ加速器Ai问答系统 V.25.09.02

🗣 Wd提问: btc汇率计算器

🤖 Ai回答: BTC汇率计算器

下面是一个美观且功能完整的比特币汇率计算器,支持实时汇率查询和多种货币转换:

html
<!DOCTYPE html
<html lang=zh-CN
<head
<meta charset=UTF-8
<meta name=viewport content=width=device-width, initial-scale=1.0
<title比特币汇率计算器</title
<link rel=stylesheet href=https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css
<style
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
background: linear-gradient(135deg, 1a2a6c, 2c3e50, 4a235a);
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
padding: 20px;
}

.container {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
border-radius: 20px;
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
width: 100%;
max-width: 500px;
padding: 40px;
color: white;
border: 1px solid rgba(255, 255, 255, 0.1);
}

.header {
text-align: center;
margin-bottom: 30px;
}

.header h1 {
font-size: 2.5rem;
margin-bottom: 10px;
text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
color: f7931a;
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
}

.header p {
font-size: 1rem;
opacity: 0.8;
}

.converter {
background: rgba(0, 0, 0, 0.2);
border-radius: 15px;
padding: 25px;
margin-bottom: 30px;
}

.input-group {
margin-bottom: 20px;
}

.input-group label {
display: block;
margin-bottom: 8px;
font-weight: 500;
font-size: 1.1rem;
}

.input-container {
display: flex;
background: rgba(255, 255, 255, 0.1);
border-radius: 10px;
overflow: hidden;
border: 1px solid rgba(255, 255, 255, 0.1);
}

.input-container input {
flex: 1;
padding: 15px;
background: transparent;
border: none;
color: white;
font-size: 1.2rem;
outline: none;
}

.input-container select {
padding: 0 15px;
background: rgba(0, 0, 0, 0.3);
border: none;
color: white;
font-size: 1rem;
cursor: pointer;
outline: none;
}

.btc-icon {
display: flex;
align-items: center;
justify-content: center;
padding: 0 15px;
background: rgba(247, 147, 26, 0.2);
color: f7931a;
font-size: 1.5rem;
}

.result {
background: rgba(247, 147, 26, 0.1);
border-radius: 10px;
padding: 20px;
text-align: center;
margin-top: 20px;
border: 1px solid rgba(247, 147, 26, 0.2);
}

.result h3 {
margin-bottom: 10px;
color: f7931a;
}

.result-value {
font-size: 2rem;
font-weight: 700;
color: f7931a;
text-shadow: 0 0 10px rgba(247, 147, 26, 0.3);
}

.exchange-rate {
margin-top: 15px;
font-size: 0.9rem;
opacity: 0.8;
}

.btn {
width: 100%;
padding: 15px;
background: linear-gradient(135deg, f7931a, e14c30);
border: none;
border-radius: 10px;
color: white;
font-size: 1.1rem;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 5px 15px rgba(247, 147, 26, 0.3);
margin-top: 10px;
}

.btn:hover {
transform: translateY(-3px);
box-shadow: 0 8px 20px rgba(247, 147, 26, 0.4);
}

.btn:active {
transform: translateY(0);
}

.info-panel {
display: flex;
justify-content: space-between;
margin-top: 30px;
font-size: 0.9rem;
opacity: 0.8;
}

.info-item {
text-align: center;
flex: 1;
padding: 10px;
background: rgba(0, 0, 0, 0.1);
border-radius: 10px;
margin: 0 5px;
}

.info-item i {
display: block;
font-size: 1.5rem;
margin-bottom: 5px;
color: f7931a;
}

.footer {
text-align: center;
margin-top: 30px;
font-size: 0.9rem;
opacity: 0.7;
}

@media (max-width: 500px) {
.container {
padding: 20px;
}

.header h1 {
font-size: 2rem;
}

.converter {
padding: 15px;
}

.input-group label {
font-size: 1rem;
}

.input-container input {
font-size: 1rem;
padding: 12px;
}

.result-value {
font-size: 1.5rem;
}

.info-panel {
flex-direction: column;
gap: 10px;
}
}
</style
</head
<body
<div class=container
<div class=header
<h1<i class=fab fa-bitcoin</i BTC汇率计算器</h1
<p实时计算比特币与其他货币的兑换汇率</p
</div

<div class=converter
<div class=input-group
<label for=btcAmount比特币数量 (BTC)</label
<div class=input-container
<input type=number id=btcAmount value=1 min=0 step=0.001
<div class=btc-icon
<i class=fab fa-bitcoin</i
</div
</div
</div

<div class=input-group
<label for=currency选择目标货币</label
<div class=input-container
<select id=currency
<option value=usd美元 (USD)</option
<option value=eur欧元 (EUR)</option
<option value=gbp英镑 (GBP)</option
<option value=jpy日元 (JPY)</option
<option value=cny人民币 (CNY)</option
<option value=krw韩元 (KRW)</option
<option value=inr印度卢比 (INR)</option
<option value=aud澳元 (AUD)</option
<option value=cad加元 (CAD)</option
</select
</div
</div

<button class=btn id=calculateBtn计算汇率</button

<div class=result
<h3转换结果</h3
<div class=result-value id=resultValue$ 0.00</div
<div class=exchange-rate id=exchangeRate1 BTC = $ 0.00</div
</div
</div

<div class=info-panel
<div class=info-item
<i class=fas fa-chart-line</i
<div24小时波动</div
<div id=change24h+2.3%</div
</div
<div class=info-item
<i class=fas fa-coins</i
<div总市值</div
<div id=marketCap$1.2T</div
</div
<div class=info-item
<i class=fas fa-exchange-alt</i
<div24小时交易量</div
<div id=volume24h$32.5B</div
</div
</div

<div class=footer
<p数据每5分钟更新一次 | 最后更新: <span id=lastUpdated刚刚</span</p
</div
</div

<script
// 模拟汇率数据(实际应用中应使用API获取实时数据)
const exchangeRates = {
usd: 61542.78,
eur: 56890.23,
gbp: 48521.67,
jpy: 6895421,
cny: 398765,
krw: 78965432,
inr: 5123456,
aud: 84213,
cad: 78234
};

// 货币符号映射
const currencySymbols = {
usd: $,
eur: €,
gbp: £,
jpy: ¥,
cny: ¥,
krw: ₩,
inr: ₹,
aud: A$,
cad: C$
};

// 货币名称
const currencyNames = {
usd: 美元,
eur: 欧元,
gbp: 英镑,
jpy: 日元,
cny: 人民币,
krw: 韩元,
inr: 印度卢比,
aud: 澳元,
cad: 加元
};

// DOM元素
const btcInput = document.getElementById('btcAmount');
const currencySelect = document.getElementById('currency');
const calculateBtn = document.getElementById('calculateBtn');
const resultValue = document.getElementById('resultValue');
const exchangeRate = document.getElementById('exchangeRate');
const lastUpdated = document.getElementById('lastUpdated');
const change24h = document.getElementById('change24h');
const marketCap = document.getElementById('marketCap');
const volume24h = document.getElementById('volume24h');

// 初始化
function init() {
// 设置最后更新时间
const now = new Date();
lastUpdated.textContent = now.toLocaleTimeString();

// 随机生成市场数据
const change = (Math.random() * 5 2.5).toFixed(2);
change24h.textContent = (change 0 ? '+' : '') + change + '%';
change24h.style.color = change = 0 ? '4cd964' : 'ff3b30';

// 计算按钮事件
calculateBtn.addEventListener('click', calculate);

// 输入变化时自动计算
btcInput.addEventListener('input', calculate);
currencySelect.addEventListener('change', calculate);

// 初始计算
calculate();
}

// 计算函数
function calculate() {
const btcAmount = parseFloat(btcInput.value) 0;
const currency = currencySelect.value;
const rate = exchangeRates[currency];
const converted = btcAmount * rate;

// 格式化数字
let formattedValue;
if (currency === 'jpy' currency === 'krw' currency === 'inr') {
formattedValue = converted.toLocaleString('ja-JP', {
maximumFractionDigits: 0,
style: 'currency',
currency: currency.toUpperCase()
});
} else {
formattedValue = converted.toLocaleString(undefined, {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
style: 'currency',
currency: currency.toUpperCase()
});
}

// 显示结果
resultValue.textContent = formattedValue;

// 显示汇率
const formattedRate = rate.toLocaleString(undefined, {
minimumFractionDigits: 2,
maximumFractionDigits: 2
});

exchangeRate.textContent = `1 BTC = ${currencySymbols[currency]} ${formattedRate} ${currencyNames[currency]}`;
}

// 模拟实时更新
function simulateRealTimeUpdates() {
setInterval(() = {
// 随机更新汇率
for (let currency in exchangeRates) {
const change = (Math.random() * 0.02 0.01); // -1% 到 +1%
exchangeRates[currency] *= (1 + change);
}

// 更新最后更新时间
const now = new Date();
lastUpdated.textContent = now.toLocaleTimeString();

// 重新计算
calculate();

// 更新市场数据
const change = (Math.random() * 0.5 0.25).toFixed(2);
change24h.textContent = (change 0 ? '+' : '') + change + '%';
change24h.style.color = change = 0 ? '4cd964' : 'ff3b30';

}, 30000); // 每30秒更新一次
}

// 页面加载完成后初始化
window.addEventListener('DOMContentLoaded', () = {
init();
simulateRealTimeUpdates();
});
</script
</body
</html

功能说明

这个比特币汇率计算器具有以下特点:

1、实时汇率转换:输入比特币数量,选择目标货币,即可计算转换后的金额
2、多种货币支持:支持美元、欧元、英镑、日元、人民币等9种主要货币
3、响应式设计:在手机、平板和桌面设备上都能完美显示
4、美观的UI:采用深色主题配合比特币橙色,具有现代感
5、市场数据展示:显示24小时价格波动、总市值和交易量
6、自动更新:模拟实时汇率变化(实际应用中应连接API)

使用说明

1、在比特币数量输入框中输入您想转换的BTC数量
2、从下拉菜单中选择目标货币
3、点击计算汇率按钮(或输入数值后自动计算)
4、查看转换结果和当前汇率

实际应用中,您可以将模拟汇率数据替换为真实的API调用(如CoinGecko、CoinMarketCap等API),以获得实时准确的汇率数据。

这个计算器完全在前端运行,无需后端支持,可以直接在浏览器中运行。


Ai问答
📣 商家广告

广告招商

广告招商

广告招商


0

IP地址: 225.134.252.92

搜索次数: 0

提问时间: 2025-09-09 01:35:24

❓ 热门提问
dogecola走势
虚拟货币三大交易所
油管五常之歌
电脑加速器可以换节点的
uu加速器网页版本
ebay定价公式
亚马逊买家登录入口官网
推特给力的博主
btc最高多少美元
纸飞机by 潭石长佩

🔗 友情链接
JJ加速器官方网站  JJ加速器  Ai问答  

📢 温馨提示:本站所有问答由Ai自动创作,内容仅供参考,若有误差请用“联系”里面信息通知我们人工修改或删除。

👉 技术支持:本站由JJ加速器提供技术支持,使用的最新版:《JJ加速器Ai问答系统 V.25.09.02》搭建本站。

上一篇 12322 12323 12324 下一篇