diff --git a/main.js b/main.js index 0f995fd..2d9dfb0 100644 --- a/main.js +++ b/main.js @@ -24,10 +24,10 @@ cursor: pointer; } #auto_update_btn.close { - background: green; + background: red; } #auto_update_btn.open { - background: red; + background: green; } ` /*添加样式*/ @@ -44,9 +44,10 @@ /*生成自动升级建筑的按钮*/ function createBtn() { var btn = document.createElement("div") - btn.title = '开' + btn.title = '未开启' + btn.className = 'close' var span = document.createElement("span"); - span.innerText = '开' + span.innerText = '未开启' btn.appendChild(span); btn.id = 'auto_update_btn' document.body.appendChild(btn) @@ -63,12 +64,12 @@ function toggleBtnText(){ const node = document.querySelector('#auto_update_btn') const text = node.innerText - if (text === '开') { - node.innerText = '关' - node.className = 'close' - } else { - node.innerText = '开' + if (text === '未开启') { + node.innerText = '运行中' node.className = 'open' + } else { + node.innerText = '未开启' + node.className = 'close' } }