-
Notifications
You must be signed in to change notification settings - Fork 0
/
36-character-counter.htm
74 lines (54 loc) · 1.96 KB
/
36-character-counter.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!DOCTYPE html>
<html>
<head>
<title>Character Counter</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<!-- LIBRARY FILES -->
<link rel="stylesheet" type="text/css" href="basic/basic.min.css">
<script src="basic/basic.min.js" type="text/javascript" charset="utf-8"></script>
<style>
/*
body {
overflow: auto !important;
}
*/
</style>
<script>
var box
var LABEL_FORMAT = "The sentence has {value} characters."
var start = function() {
page.color = "whitesmoke"
// BOX: Container box.
box = createBox(0, 0, 360, 180)
that.color = 'white'
that.round = 14
that.border = 2
that.borderColor = "rgba(0, 0, 0, 0.1)"
that.center()
// TEXTBOX: Sentence textbox.
box.txtText = createTextBox(0, 60)
box.add(that)
that.title = "Enter a sentence:"
that.center("left")
that.inputElement.addEventListener("keyup" ,function(self) {
box.lblTextCount.text = LABEL_FORMAT.replace("{value}", box.txtText.text.length)
})
// LABEL: Text count information label.
box.lblTextCount = createLabel(0, 0)
box.add(box.lblTextCount)
box.lblTextCount.aline(box.txtText, "bottom", 10)
box.lblTextCount.text = LABEL_FORMAT.replace("{value}", "0")
that.fontSize = 16
that.textColor = "gray"
page.onResize(pageResized)
}
var pageResized = function() {
box.center()
}
</script>
</head>
<body>
<!-- HTML content -->
</body>
</html>