-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
57 lines (56 loc) · 1.19 KB
/
index.html
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
<!Doctype html>
<html>
<head>
<title>New NameGenTest</title>
<style type="text/css">
#num {
display:inline;
border:1px grey solid;
margin-right:10px;
padding:2px 5px;
}
</style>
</head>
<body>
Number of Sylables <div id="num">3</div><button id="goUp"> + </button><button id="goDown"> - </button>
<br/>
<br/>
<button id="goDoIt">Generate name</button>
<br/>
<br/>
<div id="output">
</div>
<script type="text/javascript">
var byId = function(id)
{
return document.getElementById(id);
}
var num = byId('num');
byId('goUp').onclick = function()
{
num.innerHTML = parseInt(num.innerHTML, 10) + 1;
}
byId('goDown').onclick = function()
{
var val = parseInt(num.innerHTML, 10);
if(val > 2)
{
num.innerHTML = parseInt(num.innerHTML, 10) - 1;
}
}
var out = byId('output');
function print(s)
{
out.innerHTML = s + "<br/>" + out.innerHTML;
}
</script>
<script src="name_stats.js"></script>
<script src="namegen.js"></script>
<script type="text/javascript">
byId('goDoIt').onclick = function()
{
print(nameGen.randomName(parseInt(num.innerHTML, 10)));
};
</script>
</body>
</html>