<!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>
效果图:
时间: 2024-10-09 03:20:58