Press The Button
import 'dart:html';
main() {
querySelector("#button").onClick.listen(sayHello);
}
sayHello(MouseEvent event) {
querySelector("#name").text = (querySelector("#name_box") as InputElement).value;
(querySelector("#name_box") as InputElement).value = "";
}
// Follow the instructions on the button
// If you get an error msg, it's just Google...run it again.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hello World - Fancy Example</title>
<link rel="stylesheet" href="helloworldfancy.css">
</head>
<body>
<h1>Hello, <span id="name"></span></h1>
<input type="text" id="name_box">
<input type="submit" value="Type your name, then click this button:" id="button">
<script type="application/dart" src="helloworldfancy.dart"></script>
<script src="packages/browser/dart.js"></script>
</body>
</html>