1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <!DOCTYPE html> <html> <head> <meta charset= "utf-8" > <title>Sample14</title> <link rel= "stylesheet" href= "sample14.css" > </head> <body> <h1>Sample14</h1> <div id= "result" >マウスを乗せてください</div> <script type= "application/dart" src= "sample14.dart" ></script> <script src= "packages/browser/dart.js" ></script> </body> </html> |
1 2 3 4 5 6 7 8 | import 'dart:html' ; void main() { querySelector( "#result" ).onClick.listen(eventHandler); } void eventHandler(MouseEvent event){ querySelector( "#result" ).text = "マウスが重なりました!!!" ; } |