User:Ayato/common.js
跳转到导航
跳转到搜索
注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
- Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
- Internet Explorer或Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
- Opera:按 Ctrl-F5。
const neuroButton = document.querySelector("#neuro-button"); const evilButton = document.querySelector("#evil-button"); const dynamicBlock = document.querySelector("#dynamic-block"); // If elements are found, add event listeners and set the default ID if (neuroButton && evilButton && dynamicBlock) { // Function to update the ID of #dynamic-block const updateDynamicBlockId = (newId) => { if (dynamicBlock.id !== newId) { dynamicBlock.id = newId; } }; // Add event listeners to buttons neuroButton.addEventListener("click", () => { updateDynamicBlockId("show-neuro"); }); evilButton.addEventListener("click", () => { updateDynamicBlockId("show-evil"); }); // Set default ID when the script loads updateDynamicBlockId("show-neuro"); }