1 2 3 |
<form> <input type="button" id="bt" value="Cliquer !" onclick="alert('Vous avez cliqué sur '+this.id+'.');"> </form> |
1 2 3 4 5 6 7 8 |
< FORM > < INPUT type = "button " id = "bt" < /FORM> document.getElementById("bt").onclick = function (event) { alert("Vous avez cliqué sur " + this.id + "."); } |
Un article sur l’utilité des points virgule en JavaScript