Files
Nim/tests/ecmas.nim
2011-08-07 23:54:03 +02:00

21 lines
477 B
Nim
Executable File

discard """
cmd: "nimrod js --hints:on $# $#"
"""
# 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.input1", nodecl.}: ref TElement
proc OnButtonClick() {.exportc.} =
var x = parseInt($inputElement.value)
echo x*x
proc OnLoad() {.exportc.} =
echo "Welcome! Please take your time to fill in this formular!"