// Function to show an element function showElement(selector) { const element = document.querySelector(selector); if (element) { element.style.display = 'block'; } } // Function to randomly select a customer function showRandomCustomer() { const customers = ['#customer1 img', '#customer2 img', '#customer3 img']; const randomIndex = Math.floor(Math.random() * customers.length); showElement(customers[randomIndex]); } var questions = [ "如何建立统一的度量衡体系以加强中央集权?", "如何制定合理的税收政策来增强国库?", "如何组织和动员资源建造长城以防御外敌?", "如何执行禁止私人持有武器的政策?", "如何推广统一的书写系统来加强文化统一?", "如何合理征召士兵并保持军队的高效运作?", "如何处理与儒家思想相关的政治异见?", "如何加强皇帝的集权制度?", "如何建立和维护一个有效的道路交通网络?", "如何处理与周边国家的外交关系?" ]; document.addEventListener("DOMContentLoaded", function() { // Show dialogue box showElement("#dialogueBox img"); // Show all dishes showElement('#mapo-tofu img'); showElement('#roast-duck img'); showElement('#yangzhou-fried-rice img'); showElement('#braised-prawns img'); showElement('#kung-pao-chicken img'); // Show a random customer showRandomCustomer(); // Show normal Qin Shi Huang showElement('#qinshihuang img'); // Show random question var randomQuestion = questions[Math.floor(Math.random() * questions.length)]; document.getElementById("dialogueText").innerHTML = randomQuestion; });