Spaces:
Running
Running
Update index.html
Browse files2 unmodified lines345678910111213141516171819202122232425262728293031322 unmodified lines<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>我的展示網頁</title><link rel="stylesheet" href="style.css"></head><body><div class="container"><h1>歡迎來到我的靜態網頁!</h1><p>這是我的第一個網頁範例,現在已經成功在 Hugging Face 執行囉!</p><div class="box"><h2>互動小功能</h2><button id="clickBtn">點我一下</button><p id="msg"></p></div></div><script>const btn = document.getElementById('clickBtn');const msg = document.getElementById('msg');let count = 0;btn.addEventListener('click', function() {count++;msg.textContent = `你已經點擊了 ${count} 次按鈕!`;});</script></body></html>2 unmodified lines345678910111213141516171819202122232425262728293031323334353637383940414243444546472 unmodified lines<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>圖片上傳與預覽介面</title><link rel="stylesheet" href="style.css"></head><body><div class="container"><h1>圖片上傳與預覽工具</h1><p>上傳你的圖片,即可在下方即時預覽效果!</p><div class="upload-section"><label for="imageInput" class="upload-btn">選擇圖片</label><input type="file" id="imageInput" accept="image/*"></div><div class="preview-container"><div class="preview-box"><h3>圖片預覽</h3><img id="previewImage" src="" alt="尚無圖片" style="display: none;"><p id="placeholderText">尚未選擇圖片</p></div></div></div><script>const imageInput = document.getElementById('imageInput');const previewImage = document.getElementById('previewImage');const placeholderText = document.getElementById('placeholderText');imageInput.addEventListener('change', function(e) {const file = e.target.files[0];if (file) {const reader = new FileReader();reader.onload = function(event) {previewImage.src = event.target.result;previewImage.style.display = 'block';placeholderText.style.display = 'none';}reader.readAsDataURL(file);}});</script></body></html>
index.html+29-14