Method 1: Get the value directly
<button onclick= "AA (1)" > Executive </button>
<button onclick= "AA (2)" > Executive </button>
<button onclick= "AA (3)" > Executive </button>
<button onclick= "AA (4)" > Executive </button>
<script>
function AA (v) {alert (v); }
</script>
Method 2: Use the corresponding value (mainly the use of this)
<button value= "1" onclick= "AA (This)" > Executive </button>
<button value= "2" onclick= "AA (This)" > Executive </button>
<button value= "3" onclick= "AA (This)" > Executive </button>
<button value= "4" onclick= "AA (This)" > Executive </button>
<script>
function AA (t) {alert (t.value)}
</script>
Method 3: Do not directly transmit the parameter event.target get
<button value= "1" onclick= "" > Execution </button>
<button value= "2" onclick= "" > Execution </button>
<button value= "3" onclick= "" > Execution </button>
<button value= "4" onclick= "" > Execution </button>
<script>
function AA () {alert (Event.target.value)}
</script>
JavaScript multiple onclick function take corresponding value