打开/关闭菜单
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

用户:Xp00000000/Sandbox:修订间差异

来自Rizline中文维基
Xp00000000留言 | 贡献
无编辑摘要
Xp00000000留言 | 贡献
无编辑摘要
第69行: 第69行:


<html>
<html>
<div class="state-container"  
<!-- 状态切换按钮 -->
    data-states='["EZ 1", "HD 6", "IN 9"]'  
<div id="state-switcher" data-states='["EZ 1", "HD 6", "IN 9"]' onclick="switchState(this)">
    onclick="cycleAndDetect(this)">
   EZ 1
   EZ 1
</div>
</div>


<!-- 结果输出区域 -->
<!-- 其他输出区域 -->
<div class="state-result"></div>
<div id="output-area-1"></div>
<div id="output-area-2"></div>


<script>
<script>
function cycleAndDetect(element) {
function switchState(element) {
   // 原始切换逻辑
   // 切换状态
   const states = JSON.parse(element.dataset.states);
   const states = JSON.parse(element.dataset.states);
   const currentIndex = parseInt(element.dataset.current || 0);
   const nextIndex = (parseInt(element.dataset.current || 0) + 1 % states.length;
  const nextIndex = (currentIndex + 1) % states.length;
   const newState = states[nextIndex];
   element.textContent = states[nextIndex];
  element.textContent = newState;
   element.dataset.current = nextIndex;
   element.dataset.current = nextIndex;


   // 动态更新检测结果
   // 检测其他区域并更新内容
   const resultDiv = element.closest('.state-container').nextElementSibling;
  updateOutputs(newState);
   resultDiv.textContent = `当前状态: ${states[nextIndex]}`;
}
 
function updateOutputs(state) {
   const output1 = document.getElementById('output-area-1');
  const output2 = document.getElementById('output-area-2');
 
  // 根据状态检测并输出不同内容
  if (state === "EZ 1") {
    output1.textContent = "检测到状态: EZ 1 → 输出A";
    output2.innerHTML = "<span style='color:green'>✓ 条件满足</span>";
   }
  else if (state === "HD 6") {
    output1.textContent = "检测到状态: HD 6 → 输出B";
    output2.innerHTML = "<span style='color:blue'>⚠️ 注意阈值</span>";
  }
  else if (state === "IN 9") {
    output1.textContent = "检测到状态: IN 9 → 输出C";
    output2.innerHTML = "<span style='color:red'>✗ 超限</span>";
  }
}
}
</script>
</script>
</html>
</html>

2025年7月2日 (三) 18:01的版本

EZ 1
4:3
abc

EZ 1
4:3
a_ccc_1234.png


EZ 1