Skip to content

Instantly share code, notes, and snippets.

@chikoski
Created May 1, 2013 13:39
Show Gist options
  • Save chikoski/5495315 to your computer and use it in GitHub Desktop.
Save chikoski/5495315 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<form>
<input type="button" value="A" id="button_a">
<input type="button" value="B" id="button_b">
<input type="button" value="C" id="button_c">
<input type="button" value="D" id="button_d">
</form>
</body>
</html>
var word = "こんにちは";
var button_a, button_b, button_c, button_b;
button_a = document.getElementById("button_a");
button_b = document.getElementById("button_b");
button_c = document.getElementById("button_c");
button_d = document.getElementById("button_d");
button_a.onclick = function(){
var word = "こんにちは!こんにちは!";
alert(word);
};
button_b.onclick = function(){
alert(word);
};
button_c.onclick = function(){
word = "こんにちは!こんにちは!";
alert(word);
};
button_d.onclick = function(){
alert(word);
word = "こんにちは";
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment