-
Notifications
You must be signed in to change notification settings - Fork 0
/
names.html
47 lines (31 loc) · 1.23 KB
/
names.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
<html>
<body>
<SCRIPT LANGUAGE="JavaScript">
<!--
adjectivesList = new XMLHttpRequest();
adjectivesList.open("GET",'http://keithzg.ca/arpg/adjectives',false);
adjectivesList.send(null);
adjectivesArray = adjectivesList.responseText.split('\n');
nounsList = new XMLHttpRequest();
nounsList.open("GET",'http://keithzg.ca/arpg/nouns',false);
nounsList.send(null);
nounsArray = nounsList.responseText.split('\n');
suffixesList = new XMLHttpRequest();
suffixesList.open("GET",'http://keithzg.ca/arpg/suffixes',false);
suffixesList.send(null);
suffixesArray = suffixesList.responseText.split('\n');
function randomItem(){
var adjective = adjectivesArray[Math.floor(Math.random()*adjectivesArray.length)]
var noun = nounsArray[Math.floor(Math.random()*nounsArray.length)]
var suffix = suffixesArray[Math.floor(Math.random()*suffixesArray.length)]
var item = adjective + " " + noun + " of " + suffix
//alert(item);
document.getElementById('name').innerHTML = item;
}
// -->
</script>
<input type='button' onclick='randomItem()' value="click here"/>
<p>You have found: <strong id='name'>this text</strong>. </p>
</p>
</body>
</html>