Skip to content

Commit 4f46548

Browse files
Complete
1 parent b0dbf3a commit 4f46548

File tree

4 files changed

+71
-30
lines changed

4 files changed

+71
-30
lines changed
Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,35 @@
1-
// Atributos y clases
2-
3-
const title = document.getElementById('title')
4-
const name = document.getElementById('name')
5-
6-
/******* ATRIBUTOS *************/
7-
// console.log(name.getAttribute('id'));
8-
// name.setAttribute('type', 'date')
9-
// console.log(name)
10-
11-
/********CLASES **************/
12-
// title.classList.add('main-title', 'other-title')
13-
14-
// title.classList.remove('title')
15-
16-
// if(title.classList.contains('title')) console.log('Title tiene la clases title');
17-
// else console.log('Title no tiene la clases title');
18-
19-
// title.classList.replace('title', 'brian')
20-
21-
console.log(title)
22-
console.log(name)
23-
24-
25-
1+
/*Eventos de raton
2+
dbclick
3+
mouseenter
4+
mouseleave
5+
mausedown
6+
mauseup
7+
mousemove
8+
*/
9+
10+
/*Eventos teclado
11+
keydown
12+
keyup
13+
keypress
14+
* */
15+
16+
// const button = document.getElementById('button')
17+
// button.addEventListener('click', ()=>{
18+
// console.log('CLICK');
19+
// })
20+
21+
// const button = document.getElementById('button')
22+
// button.addEventListener('dblclick',()=>{
23+
// console.log('dblclick')
24+
// })
25+
26+
const button = document.getElementById('button')
27+
const box = document.getElementById('box')
28+
box.addEventListener('mouseenter', ()=>{
29+
box.classList.replace('red', 'green')
30+
})
31+
box.addEventListener('mouseleave', ()=>{
32+
box.classList.replace('green', 'red')
33+
34+
})
2635

023 Eventos raton Teclado/index.html

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8">
5-
<title> DOM </title>
5+
<title> Eventos </title>
6+
<link rel="stylesheet" href="style.css"/>
67
</head>
78
<body>
89

9-
<h1 id="title" class="title">Atributos desde javascript </h1>
10-
11-
<label for="name">Name</label>
12-
<input id="name" type="text>"/>
10+
<!-- <a href="https://developer.mozilla.org/es/docs/web/events"> Google de eventos</a>-->
11+
<!-- <a href="https://developer.mozilla.org/en-US/docs/web/events"> Google de eventos(ingles)</a>-->
1312

13+
<div id="box" class="box red"></div>
14+
<button id="button"> Click me! </button>
1415
<script src="JavaScript.js"></script>
1516
</body>
1617
</html>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,14 @@
11
### Eventos Raton Teclado
2+
3+
- Un evento es cualquier cosa que sucede en nuestro documento
4+
* El contenido se ha leido
5+
* El contenido se ha cargado
6+
* El usuario mueve el raton
7+
* EL usuario Pulsa una tecla
8+
* La ventana se ha cerrado
9+
* y un largo etc.
10+
11+
12+
```js
13+
Elemento.addEventListener('event`, callback)
14+
```
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
a,
2+
button{
3+
display: block;
4+
}
5+
6+
.box{
7+
width: 100px;
8+
height: 100px;
9+
background: red;
10+
}
11+
12+
.red{
13+
background: red;
14+
}
15+
16+
.green{
17+
background: green;
18+
}

0 commit comments

Comments
 (0)