Created
August 21, 2012 00:16
-
-
Save yoshihiro503/3409658 to your computer and use it in GitHub Desktop.
js_of_ocamlでボタンを追加するサンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let document = Dom_html.document;; | |
let window = Dom_html.window;; | |
let b = Dom_html.createInput ~_type:(Js.string "button") document;; | |
b##value <- Js.string "Push Me";; | |
b##onclick <- Dom_html.handler (fun _ -> window##alert(Js.string "hello"); Js._true);; | |
let top = Js.Opt.get (document##getElementById(Js.string "toplevel")) (fun () -> assert false);; | |
Dom.appendChild top b;; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment