-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackLettersInString.html
More file actions
44 lines (37 loc) · 1.63 KB
/
packLettersInString.html
File metadata and controls
44 lines (37 loc) · 1.63 KB
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
<!DOCTYPE html>
<html>
<head>
<title>Test for packLettersInString/unpackLettersInString functions</title>
<script src='packLettersInString.js'></script>
</head>
<body>
<p>
<input type='text' id='textEditor' value='A3B2A5CD' />
</p>
<p>
<input type='button' id='buttonPack' value='Pack string' onclick='buttonPackOnClick()' />
<input type='button' id='buttonUnpack' value='Unpack string' onclick='buttonUnpackOnClick()' />
<input type='button' id='buttonFullTest' value='Full Test' onclick='buttonFullTestOnClick()' />
</p>
<p>
Output:<br />
<textarea id='textareaOutput' cols='125' rows='25'></textarea>
</p>
</body>
<script>
function buttonPackOnClick() {
textareaOutput.value = textareaOutput.value + packLettersInString(textEditor.value) + '\n\n';
} // buttonPackOnClick
function buttonUnpackOnClick() {
textareaOutput.value = textareaOutput.value + unpackLettersInString(textEditor.value) + '\n\n';
} // buttonUnpackOnClick
function buttonFullTestOnClick() {
var LPacked = packLettersInString(textEditor.value);
var LUnpacked = unpackLettersInString(LPacked);
textareaOutput.value =
textareaOutput.value +
'String \"' + textEditor.value + '\" was packed to \"' + LPacked + '\" and was unpacked to \"' + LUnpacked + '\". And it is ' + (textEditor.value == LUnpacked ? 'valid' : 'invalid') + ' result.\n' +
'String \"' + textEditor.value + '\" was unpacked to \"' + LUnpacked + '\" and was packed to \"' + LPacked + '\". And it is ' + (textEditor.value == LPacked ? 'valid' : 'invalid') + ' result.\n\n';
} // buttonFullTestOnClick()
</script>
</html>