Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
bootcamp02-desafio02
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Liza Coronel
bootcamp02-desafio02
Commits
1e863321
Commit
1e863321
authored
Mar 07, 2018
by
roshka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Desafio 02, damas
parents
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
149 additions
and
0 deletions
+149
-0
damas.html
+38
-0
ficha.jpg
+0
-0
funciondamas.js
+111
-0
No files found.
damas.html
0 → 100644
View file @
1e863321
<!DOCTYPE html>
<html>
<head>
<title>
Damas
</title>
<script
type=
"text/javascript"
src=
"funciondamas.js"
></script>
</head>
<body>
<table
border=
"1px"
align=
"center"
>
<tr
>
<td
id=
"F00"
height=
"50px"
width=
"50px"
style=
"background: black "
onclick=
"seleccionarCelda(this);"
></td>
<td
id=
"F01"
height=
"50px"
width=
"50px"
></td>
<td
id=
"F02"
nombre=
"F02"
height=
"50px"
width=
"50px"
style=
"background: black "
onclick=
"seleccionarCelda(this)"
></td>
<td
id=
"F03"
nombre=
"F03"
height=
"50px"
width=
"50px"
></td>
</tr>
<tr>
<td
id=
"F10"
nombre=
"F10"
height=
"50px"
width=
"50px"
></td>
<td
id=
"F11"
height=
"50px"
width=
"50px"
style=
"background: black"
onclick=
"seleccionarCelda(this)"
></td>
<td
id=
"F12"
nombre=
"F12"
height=
"50px"
width=
"50px"
></td>
<td
id=
"F13"
nombre=
"F13 "
height=
"50px"
width=
"50px"
style=
"background: black"
onclick=
"seleccionarCelda(this)"
></td>
</tr>
<tr>
<td
id=
"F20"
nombre=
"F20"
height=
"50px"
width=
"50px"
style=
"background: black"
onclick=
"seleccionarCelda(this)"
></td>
<td
id=
"F21"
nombre=
"F21"
height=
"50px"
width=
"50px"
></td>
<td
id=
"F22"
nombre=
"F22"
height=
"50px"
width=
"50px"
style=
"background: black"
onclick=
"seleccionarCelda(this)"
></td>
<td
id=
"F23"
nombre=
"F23"
height=
"50px"
width=
"50px"
></td>
</tr>
<tr>
<td
id=
"F30"
nombre=
"F30"
height=
"50px"
width=
"50px"
></td>
<td
id=
"F31"
nombre=
"F31"
height=
"50px"
width=
"50px"
style=
"background: black"
onclick=
"seleccionarCelda(this)"
></td>
<td
id=
"F32"
nombre=
"F32"
height=
"50px"
width=
"50px"
></td>
<td
id=
"F33"
nombre=
"F33"
height=
"50px"
width=
"50px"
style=
"background: black"
onclick=
"seleccionarCelda(this)"
><img
src=
"ficha.jpg"
height=
"50px"
width=
"50px"
></img></td>
</tr>
</table>
</body>
</html>
\ No newline at end of file
ficha.jpg
0 → 100644
View file @
1e863321
3.57 KB
funciondamas.js
0 → 100644
View file @
1e863321
var
celda
=
''
;
//var celda_actual='';
function
seleccionarCelda
(
id
){
if
(
celda
!=
''
){
mover
(
id
,
celda
);
celda
=
''
;
}
else
{
if
(
id
.
innerHTML
!=
""
){
celda
=
id
;
id
.
style
.
background
=
"yellow"
;
}
}
}
function
mover
(
celda_actual
,
celda
){
if
(
celda
.
id
==
'F00'
){
if
(
celda_actual
.
id
==
'F11'
){
celda_actual
.
innerHTML
=
celda
.
innerHTML
;
celda
.
innerHTML
=
' '
;
celda
.
style
.
background
=
"black"
;
}
else
{
if
(
celda
==
'F00'
){
if
((
celda_actual
.
id
==
'F01'
)
||
(
celda_actual
.
id
==
'F10'
)){
alert
(
"Movimiento Invalido!. Las fichas deben moverse de manera diagonal"
)
}
}
}
}
if
(
celda
.
id
==
'F02'
){
if
((
celda_actual
.
id
==
'F11'
)
||
(
celda_actual
.
id
==
'F13'
)){
celda_actual
.
innerHTML
=
celda
.
innerHTML
;
celda
.
innerHTML
=
''
;
celda
.
style
.
background
=
"black"
;
}
else
{
elda
.
style
.
background
=
"skyblue"
;
alert
(
"Movimiento Invalido!. Las fichas deben moverse de manera diagonal"
)}
}
if
(
celda
.
id
==
'F11'
){
if
((
celda_actual
.
id
==
'F20'
)
||
(
celda_actual
.
id
==
'F22'
)
||
(
celda_actual
.
id
==
'F02'
)
||
(
celda_actual
.
id
==
'F00'
)){
celda_actual
.
innerHTML
=
celda
.
innerHTML
;
celda
.
innerHTML
=
''
;
celda
.
style
.
background
=
"black"
;
}
else
{
celda
.
style
.
background
=
"black"
;
alert
(
"Movimiento Invalido!. Las fichas deben moverse de manera diagonal"
)}
}
if
(
celda
.
id
==
'F13'
){
if
((
celda_actual
.
id
==
'F22'
)
||
(
celda_actual
.
id
==
'F02'
)){
celda_actual
.
innerHTML
=
celda
.
innerHTML
;
celda
.
innerHTML
=
''
;
celda
.
style
.
background
=
'black'
}
else
{
celda
.
style
.
background
=
"black"
;
alert
(
"Movimiento Invalido!. Las fichas deben moverse de manera diagonal"
)
}
}
if
(
celda
.
id
==
'F20'
){
if
((
celda_actual
.
id
==
'F31'
)
||
(
celda_actual
.
id
==
'F11'
)){
celda_actual
.
innerHTML
=
celda
.
innerHTML
;
celda
.
innerHTML
=
''
;
celda
.
style
.
background
=
"black"
;
}
else
{
celda
.
style
.
background
=
"skyblue"
;
alert
(
"Movimiento Invalido!. Las fichas deben moverse de manera diagonal"
)}
}
if
(
celda
.
id
==
'F22'
){
if
((
celda_actual
.
id
==
'F31'
)
||
(
celda_actual
.
id
==
'F33'
)
||
(
celda_actual
.
id
==
'F11'
)
||
(
celda_actual
.
id
==
'F13'
)){
celda_actual
.
innerHTML
=
celda
.
innerHTML
;
celda
.
innerHTML
=
''
;
celda
.
style
.
background
=
"black"
;
}
else
{
celda
.
style
.
background
=
"skyblue"
;
alert
(
"Movimiento Invalido!. Las fichas deben moverse de manera diagonal"
)}
}
if
(
celda
.
id
==
'F31'
){
if
((
celda_actual
.
id
==
'F20'
)
||
(
celda_actual
.
id
==
'F22'
)){
celda_actual
.
innerHTML
=
celda
.
innerHTML
;
celda
.
innerHTML
=
''
;
celda
.
style
.
background
=
"black"
;
}
else
{
celda
.
style
.
background
=
"skyblue"
;
alert
(
"Movimiento Invalido!. Las fichas deben moverse de manera diagonal"
)}
}
if
(
celda
.
id
==
'F33'
){
if
(
celda_actual
.
id
==
'F22'
){
celda_actual
.
innerHTML
=
celda
.
innerHTML
;
celda
.
innerHTML
=
''
;
celda
.
style
.
background
=
"black"
;
}
else
{
celda
.
style
.
background
=
"black"
;
alert
(
"Movimiento Invalido!. Las fichas deben moverse de manera diagonal"
)}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment