MiT Asked:2020-09-19 18:04:45 +0800 CST2020-09-19 18:04:45 +0800 CST 2020-09-19 18:04:45 +0800 CST 如何编写一个脚本,在折叠窗口中定期显示英文单词及其翻译,然后将其关闭? 772 我在学一点js,遇到了这么一个奇怪的任务,一方面很有趣,另一方面,看不懂。 编写一个脚本,定期在折叠窗口中显示英文单词及其翻译,然后将其关闭。 问题是: 怎么理解? 怎么做? javascript 1 个回答 Voted Best Answer MiT 2020-09-19T20:13:14+08:002020-09-19T20:13:14+08:00 我确实喜欢这个) var notransl = ["Яблоко", "Привет", "Пока", "Слово", "Мир", "Машина"]; var transl = ["Apple", "Hello", "Bye", "Word", "World", "Machine"]; function call() { popup = window.open("trnsl.html"); setTimeout(wait, 8000); } function caller() { setInterval(call, 12000); } function wait() { popup.close(); } function showMessage() { var x = Math.round(Math.random() * (notransl.length - 1)); var y = Math.round(Math.random() * (notransl.length - 1)); if (x == y) { y = Math.round(Math.random() * (notransl.length - 1)); } document.write('<br>' + notransl[x] + " - " + transl[x]); document.write('<br>' + notransl[y] + " - " + transl[y]); } html, body{ width: 100%; height: 100%; } <body onload="showMessage();">
我确实喜欢这个)