Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 72531

One function activated by two buttons

$
0
0

I have two buttons and one function called 'starta' and it has parameter'oi'.

My question is shouldn't the button with id of 'ooii' just work and not both of them ? Could somebody explain the reason both of these buttons are working ?

function starta(oi) {
  document.getElementById(oi).style.backgroundColor = "green";
}
button.rond {
  width: 60px;
  height: 60px;
}
<table><tr><td class="np"><button style="background-color:yellow" id="y" class="rond" onclick="starta('y')">alotus</button></td></tr><tr><td class="np"><button style="background-color:yellow" id="ooii" class="rond" onclick="starta('ooii')">alotus</button></td></tr></table>

Viewing all articles
Browse latest Browse all 72531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>