<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div>
<span id="num">1</span>
<button id="prev">上一页</button>
<button id="next">下一页</button>
</div>
</body>
<script>
var a=document.getElementById("num");
var b=document.getElementById("prev");
var c=document.getElementById("next");
var str=0;
function test(){
var d;
c.οnclick=function(){
d=++str;
alert(d);
}
b.οnclick=function(){
var e=--d;
alert(e);
}
}
test();
</script>
</html>
转载于:https://www.cnblogs.com/ytg1120/p/7239716.html