更多操作
Xp00000000(留言 | 贡献) 小无编辑摘要 标签:手工回退 |
Xp00000000(留言 | 贡献) 小无编辑摘要 |
||
第1行: | 第1行: | ||
<html> | <html> | ||
<script> | <script> | ||
function | function cycleTextData(element) { | ||
const states = JSON.parse(element.dataset.states || '["A", "B", "C"]'); | |||
const currentIndex = parseInt(element.dataset.current || 0); | |||
const nextIndex = (currentIndex + 1) % states.length; | |||
element.textContent = states[nextIndex]; | |||
element.dataset.current = nextIndex; | |||
} | } | ||
</script> | </script> | ||
<div | |||
<div onclick="cycleTextData(this)" data-states='["苹果", "香蕉", "橙子"]' | |||
data-current="0" style="cursor:pointer; padding:8px; border:1px solid #ddd;"> | |||
苹果 | |||
</div> | |||
</html> | </html> |
2025年7月1日 (二) 21:18的版本
苹果