-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
51 lines (45 loc) · 1.25 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
<html>
<head>
<title>
3d6 roller
</title>
</head>
<body>
<style>
.attributes {
font-size: 40px;
}
</style>
<!-- need to make this into a form eventually-->
<span class= "attributes" id="str"></span><br>
<span class= "attributes" id="int"></span><br>
<span class= "attributes" id="wis"></span><br>
<span class= "attributes" id="dex"></span><br>
<span class= "attributes" id="con"></span><br>
<span class= "attributes" id="lks"></span><br>
<span class= "attributes" id="cha"></span><br>
<script>
var attributesArray = ["str","int","wis","dex","con","lks","cha"];
var attributesArrayLength = attributesArray.length;
var diceRoll;
var rollNumber;
var totalRoll;
var counter;
var d100;
var attribValue
//for (counter=0;counter<7;counter++) {
for (counter=0;counter<attributesArrayLength;counter++) {
totalRoll=0;
for (rollNumber=0;rollNumber<3;rollNumber++) {
diceRoll = Math.floor(Math.random()*6)+1;
//document.write(diceRoll+" ");
totalRoll +=diceRoll;
}
d100=Math.floor(Math.random()*100);
attribValue=totalRoll + (d100 * 0.01)
document.getElementById(attributesArray[counter]).textContent=attributesArray[counter] + ":" + attribValue.toFixed(2);
//document.write("<br>"+attributesArray[counter]+":"+totalRoll+"."+d100+"<br><br><br>");
}
</script>
</body>
</html>