Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions basicos.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"folders": [
{
"path": "."
},
{
"path": "C:\\Users\\usuario\\Desktop\\Ejercicios\\xabier\\botones compra"
}
],
"settings": {
"workbench.colorCustomizations": {}
}
}
9 changes: 9 additions & 0 deletions exercici1/css/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@import url('https://fonts.googleapis.com/css?family=Raleway:400,500,600,700,800&display=swap');
body{
font-family: 'Raleway', Verdana, Geneva, Tahoma, sans-serif;
font-size: 125%;

}
.container{
margin-top:9vh;
}
Binary file added exercici1/img/click.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions exercici1/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="./css/styles.css">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Basic jS1</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-sm">

</div>
<div class="col-sm">
<div class="card" style="width: 18rem;">
<img src="./img/click.png" class="card-img-top" alt="TheClick36">
<div class="card-body">
<h5 class="card-title">IndexOf()</h5>
<p class="text">Click the <button class="btn btn-secondary" id="boton1" onclick="myFunction()"> Push me</button> to see the index of j in:</p>
<p class="text">"My favorite dessert is Jelly"</p>
<p class="card-text" id="pintar" ></p>
<!-- <p class="row">
<p class="col-sm col-md-4">
<button class="btn btn-secondary" id="boton2">Delete</button>
</p>
</p> -->
<a href="https://www.theclick36.com/" target= "_blank" class="btn btn-primary">Go somewhere</a>
</div>
</div>
</div>
<div class="col-sm">

</div>
</div>
</div>
<script src="./js/functions.js"></script>

</body>
</html>
15 changes: 15 additions & 0 deletions exercici1/js/functions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

let x = "My favorite dessert is Jello";
let y = x.indexOf('J');
console.log(y);
/* document.getElementById('boton1').onClick = function(){
myFunction()
}; */

function myFunction() {


document.getElementById('pintar').innerHTML = y;
}


9 changes: 9 additions & 0 deletions exercici2/css/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@import url('https://fonts.googleapis.com/css?family=Raleway:400,500,600,700,800&display=swap');
body{
font-family: 'Raleway', Verdana, Geneva, Tahoma, sans-serif;
font-size: 125%;

}
.container{
margin-top:9vh;
}
Binary file added exercici2/img/click.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions exercici2/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="./css/styles.css">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Basic jS2</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-sm">

</div>
<div class="col-sm">
<div class="card" style="width: 18rem;">
<img src="./img/click.png" class="card-img-top" alt="TheClick36">
<div class="card-body">
<h5 class="card-title">Prompt</h5>
<p class="text">Click the <button class="btn btn-secondary" id="boton1" onclick="myFunction()"> Boton </button> to see the answer to the prompts!</p>
<p class="card-text" id="pintar" ></p>
<a href="https://www.theclick36.com/" target= "_blank" class="btn btn-primary">Go somewhere</a>
</div>
</div>
</div>
<div class="col-sm">

</div>
</div>
</div>
<script src="./js/functions.js"></script>

</body>
</html>
12 changes: 12 additions & 0 deletions exercici2/js/functions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
let nombre = prompt('¿ Cual es su nombre por favor?');
let apellidos = prompt(' ¿y su primer apellido?');
let juntos = (`${nombre} ${apellidos}`);
console.log(nombre + " " + apellidos);

function myFunction() {
juntos == (`${nombre = ' '}`)|| juntos == (`${nombre = ' '} ${apellidos = ' '}`)?
document.getElementById('pintar').innerHTML = "Hola desconocido!":

document.getElementById('pintar').innerHTML = (`Hola ${juntos}`);

} ;
9 changes: 9 additions & 0 deletions exercici3/css/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@import url('https://fonts.googleapis.com/css?family=Raleway:400,500,600,700,800&display=swap');
body{
font-family: 'Raleway', Verdana, Geneva, Tahoma, sans-serif;
font-size: 125%;

}
.container{
margin-top:9vh;
}
Binary file added exercici3/img/click.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions exercici3/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="./css/styles.css">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Basic jS3/Copia</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-sm">

</div>
<div class="col-sm">
<div class="card" style="width: 18rem;">
<img src="./img/click.png" class="card-img-top" alt="TheClick36">
<div class="card-body">
<h5 class="card-title">Match!</h5>
<p class="text">Click the <button class="btn btn-secondary" id="boton1" onclick="myFunction()"> Boton </button> to see if the words match!.</p>
<p class="card-text" id="pintar" ></p>
<p class="card-text" id="pintar1" ></p>
<p class="card-text" id="pintar2" ></p>
<a href="https://www.w3schools.com/jsref/jsref_includes.asp" target= "_blank" class="btn btn-primary">Go somewhere</a>
</div>
</div>
</div>
<div class="col-sm">

</div>
</div>
</div>
<script src="./js/functions.js"></script>

</body>
</html>
36 changes: 36 additions & 0 deletions exercici3/js/functions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@


/* function azar(){
// recorrido palabras pa generar el random
for (i=0; i < palabrasLength; i++){
document.getElementById('pintar').innerHTML = azar();

}

} */
function myFunction() {
let texto = prompt('Introduce una palabra de la A a la Z').toLowerCase();

document.getElementById('pintar1').innerHTML = (`La letra inscrita es la ${texto}`);

// Debo generar YO el random y no cogerlo del string escrito en prompt

//declaración de DONDE coge el string para generar el random

let palabras = "ABCÇDEFGHIJKLMNOPQRSTUVWXTZabcçdefghiklmnopqrstuvwxyz";
// cuantos elementos quiero random
// let palabrasLength = " ";
// donde coloco el valor de ese random

let azarPalabra = Math.floor(Math.random()* palabras.toLowerCase().length);

let randomPalabra = palabras.toLowerCase().substring(azarPalabra, azarPalabra+1);
document.getElementById('pintar2').innerHTML = (`La letra generada es la ${randomPalabra}`);
//comparamos los dos valores

let compara = texto.includes(randomPalabra);
document.getElementById('pintar').innerHTML = compara;

}
/* Finalmente he tenido que buscar el random en el prompt. pequeño descanso y quiero hacerlo con un random */

9 changes: 9 additions & 0 deletions exercici4/css/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@import url('https://fonts.googleapis.com/css?family=Raleway:400,500,600,700,800&display=swap');
body{
font-family: 'Raleway', Verdana, Geneva, Tahoma, sans-serif;
font-size: 125%;

}
.container{
margin-top:9vh;
}
Binary file added exercici4/img/click.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions exercici4/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="./css/styles.css">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Basic jS4</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-sm">

</div>
<div class="col-sm">
<div class="card" style="width: 18rem;">
<img src="./img/click.png" class="card-img-top" alt="TheClick36">
<div class="card-body">
<h5 class="card-title">Jubilación</h5>
<p class="text">Click the <button class="btn btn-secondary" id="boton1" onclick="myFunction()"> Button</button> to see how long til...</p>
<p class="text">You stop working!</p>
<p class="card-text" id="pintar" ></p>
<!-- <p class="row">
<p class="col-sm col-md-4">
<button class="btn btn-secondary" id="boton2">Delete</button>
</p>
</p> -->
<a href="https://www.w3schools.com/js/js_if_else.asp" target= "_blank" class="btn btn-primary">Go somewhere</a>
</div>
</div>
</div>
<div class="col-sm">

</div>
</div>
</div>
<script src="./js/functions.js"></script>

</body>
</html>
29 changes: 29 additions & 0 deletions exercici4/js/functions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

let edad = prompt("How old are you?");
let edadJubilacion = 67;
let jubiladoYa = (edadJubilacion - edad);
console.log(edad);


/* function jubilado(){
if(edad < edadJubilacion){
return ("You need still" +" "+ jubiladoYa +" " +" to become a goverment employ!")
}else{
return ("You are rather lucky,"+" "+ -jubiladoYa +" "+ "years enjoying your well earned peace of mind.")
}
};

function myFunction() {
document.getElementById('pintar').innerHTML = jubilado();
} ;
document.getElementById('boton1').onClick = function(){
myFunction();
}; */
const myFunction = () =>{
edad < edadJubilacion ?
document.getElementById('pintar').innerHTML = (`You need still ${jubiladoYa} to become a goverment employ!`):
document.getElementById('pintar').innerHTML = (`You are rather lucky ${-jubiladoYa} years enjoying your well earned peace of mind.`);
}



9 changes: 9 additions & 0 deletions exercici5/css/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@import url('https://fonts.googleapis.com/css?family=Raleway:400,500,600,700,800&display=swap');
body{
font-family: 'Raleway', Verdana, Geneva, Tahoma, sans-serif;
font-size: 125%;

}
.container{
margin-top:9vh;
}
Binary file added exercici5/img/click.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading