Skip to content

Instantly share code, notes, and snippets.

@jamc92
Created February 22, 2015 16:09
Show Gist options
  • Save jamc92/ca1fb6d83cd41edd9a05 to your computer and use it in GitHub Desktop.
Save jamc92/ca1fb6d83cd41edd9a05 to your computer and use it in GitHub Desktop.
JS - getInfoEvent
<!DOCTYPE html>
<html>
<head>
<title> Evento de información </title>
<script>
function infoButton(buttonId, buttonName, buttonValue) {
var idButton = "ID del boton " + buttonId + " \n";
var nameButton = "Button's name: " + buttonName + " \n";
var valueButton = "Button's value: " + buttonValue + " \n";
alert(idButton + nameButton + valueButton);
}
</script>
</head>
<body>
<input id="1" type="button" name="First Button" value="Left Button" onclick="infoButton(this.id, this.name, this.value);" />
<input id="2" type="button" name="Second Button" value="Center Button" onclick="infoButton(this.id, this.name, this.value);" />
<input id="3" type="button" name="Third Button" value="Right Button" onclick="infoButton(this.id, this.name, this.value);" />
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment