'; } } function updateCurrencyPrices() { // 数値を3桁区切りでフォーマットする関数 function formatNumber(number) { return Math.round(number).toLocaleString('ja-JP'); } // 台湾ドルの価格更新 document.querySelectorAll('.twd-price').forEach(element => { const usdPrice = parseFloat(element.getAttribute('data-usd')); const twdPrice = usdPrice * exchangeRates.TWD; element.textContent = `NT$${formatNumber(twdPrice)}`; }); // 香港ドルの価格更新 document.querySelectorAll('.hkd-price').forEach(element => { const usdPrice = parseFloat(element.getAttribute('data-usd')); const hkdPrice = usdPrice * exchangeRates.HKD; element.textContent = `HK$${formatNumber(hkdPrice)}`; }); // 日本円の価格更新 document.querySelectorAll('.jpy-price').forEach(element => { const usdPrice = parseFloat(element.getAttribute('data-usd')); const jpyPrice = usdPrice * exchangeRates.JPY; element.textContent = `¥${formatNumber(jpyPrice)}`; }); } document.addEventListener("DOMContentLoaded", function () { document.querySelector('.close').onclick = function() { document.getElementById('multiCurrencyModal').style.display = 'none'; }; // モーダル外クリックで閉じる window.onclick = function(event) { const modal = document.getElementById('multiCurrencyModal'); if (event.target == modal) { modal.style.display = 'none'; } }; // Escキーでモーダルを閉じる document.addEventListener('keydown', function(event) { if (event.key === 'Escape') { document.getElementById('multiCurrencyModal').style.display = 'none'; } }); });