<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>sample</title> <script type="text/javascript"> var agyo = "あいうえお"; var kagyo = "かきくけこ"; window.onload = function() { document.getElementById("button1").addEventListener("click", clickListener, false); }; function clickListener(e) { alert(agyo); } </script> </head> <body> <input type="button" value="click" id="button1"> </body> </html>