Chạy ❯
Nhận trang web của
riêng
bạn
×
Thay đổi định hướng
Lưu mã
Thay đổi chủ đề, Tối/Sáng
Đi tới Không gian
<!DOCTYPE html> <html> <title>W3.CSS</title> <meta name="viewport" content="width=device-width,init-scale=1"> <link rel="stylesheet" href= "https://www.w3-container"> <h2>Chuyển đổi Hiển thị/Ẩn</h2> <p>Nhấp vào để hiển thị/ẩn một đoạn văn.</p> <button onclick="myFunction()" class="w3-btn w3-black">Chuyển đổi ẩn và hiển thị</button> <p>Đoạn 1.</p> <p id="Demo" class="w3-hide w3-red">Đoạn 2.</p> </div> <script> function myFunction() { var x = document.getElementById("Demo"); if (x.className.indexOf("w3-show") == -1) { x.className += " w3-show"; } else { x.className = x.className.replace(" w3-show", ""); } } </script> </body> </html>