mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-02 19:22:40 +00:00
17 lines
435 B
Nim
17 lines
435 B
Nim
# This file tests the ECMAScript generator
|
|
|
|
import
|
|
dom, strutils
|
|
|
|
# We need to declare the used elements here. This is annoying but
|
|
# prevents any kind of typo:
|
|
var
|
|
inputElement {.importc: "document.form1.input", nodecl.}: ref TElement
|
|
|
|
proc OnButtonClick() {.exportc.} =
|
|
var x: int = parseInt($inputElement.value)
|
|
echo($(x * x))
|
|
|
|
proc OnLoad() {.exportc.} =
|
|
echo("Welcome! Please take your time to fill in this formular!")
|