Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width">
- <title>JS Bin</title>
- <style id="jsbin-css">
- #Main{
- background: black;
- margin: 0 auto;
- display: block;
- width: 400px;
- height: 300px;
- border:solid;
- border-color: grey;
- text-align:center;
- }
- #btn{
- width: 100px;
- height:25px;
- color: white;
- background: red;
- border: solid;
- border-color: grey;
- }
- p{
- font-size: 20px;
- color: white;
- }
- body{
- background: url("");
- }
- </style>
- </head>
- <body>
- <div id="Main">
- <h1>This is my input</h1>
- <input id="inpt1" placeholder="Name 1"><br>
- <input id="inpt2" placeholder="Name 2"><br>
- <button id="btn" onclick="u()">Result</button>
- <p class="target1" id="resultFirst"></p>
- <p class="target2" id="resultLast"></p>
- </div>
- <script id="jsbin-javascript">
- function u(){
- var N1 = document.getElementById("inpt1").value;
- var N2 = document.getElementById("inpt2").value;
- document.querySelector(".target1").innerHTML = (N1);
- document.querySelector(".target2").innerHTML = (N2);
- console.log("N1");
- window.sessionStorage.setItem("first", N1);
- window.localStorage.last = N2;
- }
- document.getElementById("resultFirst").innerHTML = window.sessionStorage.getItem('first');
- document.getElementById("resultLast").innerHTML = window.localStorage.last;
- </script>
- <script id="jsbin-source-css" type="text/css">#Main{
- background: black;
- margin: 0 auto;
- display: block;
- width: 400px;
- height: 300px;
- border:solid;
- border-color: grey;
- text-align:center;
- }
- #btn{
- width: 100px;
- height:25px;
- color: white;
- background: red;
- border: solid;
- border-color: grey;
- }
- p{
- font-size: 20px;
- color: white;
- }
- body{
- background: url("");
- }
- </script>
- <script id="jsbin-source-javascript" type="text/javascript">function u(){
- var N1 = document.getElementById("inpt1").value;
- var N2 = document.getElementById("inpt2").value;
- document.querySelector(".target1").innerHTML = (N1);
- document.querySelector(".target2").innerHTML = (N2);
- console.log("N1");
- window.sessionStorage.setItem("first", N1);
- window.localStorage.last = N2;
- }
- document.getElementById("resultFirst").innerHTML = window.sessionStorage.getItem('first');
- document.getElementById("resultLast").innerHTML = window.localStorage.last;
- </script></body>
- </html>
Add Comment
Please, Sign In to add comment