<pre><!DOCTYPE html> <html> <head> <meta charset='utf-8'> <meta http-equiv='X-UA-Compatible' content='IE=edge'> <title>Page Title</title> <meta name='viewport' content='width=device-width, initial-scale=1'> <link rel='stylesheet' type='text/css' media='screen' href='main.css'> <script src='main.js'></script> </head> <body> <button class="gomb">1</button> <button class="gomb">2</button> <button class="gomb">3</button> <button class="gomb">4</button> <button class="gomb">5</button> <button class="gomb">6</button> <button class="gomb">7</button> <button class="gomb">8</button> <button class="gomb">9</button> <button class="gomb">10</button> <script> const gombok=document.getElementsByTagName('button') for(i=0;i<gombok.length;i++){ x=gombok[i] x.onclick=function(){ myFunction(x) } } function myFunction(btn){ btn.textContent='Button Clicked!' } </script> </body> </html>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)