Repository navigation
Expand file tree
/
Copy pathscript2.js
More file actions
96 lines (91 loc) · 2.19 KB
/
Copy pathscript2.js
File metadata and controls
96 lines (91 loc) · 2.19 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
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
$("#strt").click(function trig()
{
if(qvar === 'quit')
{
qvar = "";
$('#result').html('Who\'s Turn :<span id="turn" style="font-size:30px;">X</span>');
nullifyarr();
}
playerName();
$("#turn").html(p1);
console.log('trig cal');
$('#b1,#b2,#b3,#b4,#b5,#b6,#b7,#b8,#b9').on('click', function (event)
{
if($(event.target).attr('id') == 'b1')
{
console.log(this.id);
fill(this.id, 0, 0);
}
else if($(event.target).attr('id') == 'b2')
{
fill(this.id, 0, 1);
}
else if($(event.target).attr('id') == 'b3')
{
console.log("bt 3 clicked");
fill(this.id, 0, 2);
}
else if($(event.target).attr('id') == 'b4')
{
fill(this.id, 1, 0);
}
else if($(event.target).attr('id') == 'b5')
{
fill(this.id, 1, 1);
}
else if($(event.target).attr('id') == 'b6')
{
fill(this.id, 1, 2);
}
else if($(event.target).attr('id') == 'b7')
{
fill(this.id, 2, 0);
}
else if($(event.target).attr('id') == 'b8')
{
fill(this.id, 2, 1);
}
else if($(event.target).attr('id') == 'b9')
{
fill(this.id, 2, 2);
}
console.clear();
display();
pass();
console.log(count);
});
});
function showDiv()
{
//console.log("showDiv called/");
document.getElementById("nameDiv").style.display = "block";
document.getElementById("nameDivCom").style.display = "none";
}
function showDivCom()
{
//console.log("showDiv called/");
document.getElementById("nameDivCom").style.display = "block";
document.getElementById("nameDiv").style.display = "none";
$('#' + this.id).html("Computer");
}
$("#playerOne").keydown(function (event)
{
var val = $("#playerOne").val();
$('#' + this.id).html(val);
});
$("#playerOneCom").keydown(function (event)
{
var val = $("#playerOneCom").val();
$('#' + this.id).html(val);
});
$("#playerTwo").keydown(function (event)
{
var val = $("#playerTwo").val();
$('#' + this.id).html(val);
});
$('#quit').click(function ()
{
/*console.log('new game initiated');
newGame();*/
quitVar();
});