首页 > 代码库 > 点击后加1或减去1

点击后加1或减去1

<!doctype html><html lang="en"><head>    <meta charset="UTF-8">    <title>点击后加1或减去1</title></head><body>    <span id="num">0</span><button onclick="document.getElementById(‘num‘).innerHTML++">点击加1</button>    <span id="num1">55</span>    <button onclick="document.getElementById(‘num1‘).innerHTML--">点击减1</button></body></html>

效果图:

技术分享

点击后加1或减去1