-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSESSION.html
More file actions
56 lines (48 loc) · 1.79 KB
/
Copy pathSESSION.html
File metadata and controls
56 lines (48 loc) · 1.79 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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width"/>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<title>Ejercicio 18.1</title>
<style>
button {
width: 90%;
height: 25px;
margin: 5px auto;
}
ul{margin:0; padding:0; font-size:12px}
li{list-style-type:none; padding:10px 0; border-bottom: solid 1px #ccc }
</style>
<script type="text/javascript">
function validado () {
if (sessionStorage.validado!="true"){
alert("no estas logeados");
}
}
function guardar () {
sessionStorage["Nombre"] = $("#nombre").val();
sessionStorage["pass"] = $("#pass").val();
}
function leer () {
$("#nombre2").text("Acabas de inciar Sescion " + sessionStorage["validado"] + ", Como estas!");
}
function validar () {
if(sessionStorage.Nombre===$("#nombre").val() && sessionStorage.pass===$("#pass").val()){
sessionStorage.validado = "true";
}
}
</script>
</head>
<body onload="validado()">
<input type="text" name="nombre" id="nombre" value="">
<input type="text" name="pass" id="pass" value="">
<button onclick="guardar()"> Guardar </button>
<button onclick="leer()"> leer</button><br>
<button onclick="validar()"> leer</button><br>
<br>
<br>
<br>
<label for="nombre" id="nombre2"></label>
</body>
</html>