title: How to display username in all pages after successful login by using only javascript?
body: <p>I am trying to create a login form using html,css and javascript and i have done it.But, the problem here is i could not display the username in all pages after the user has succeeded in login. And also it seems that after the user has succeeded in login,it stays at the same page which is supposed to be at another page.Can anyone please help me with this code or give me a hint so that i could do the rest.</p>
  
  <p>Here is the code i am using</p>
  
  <p></p>
  
  <pre><code>&lt;head&gt;
    &lt;title&gt;Login page&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;h1 style="font-family:Comic Sans Ms;text-align="center";font-size:20pt;
   color:#00FF00;&gt;Simple Login Page&lt;/h1&gt;
  
   &lt;form name="myForm" method="post" action="target.html"&gt;
   Username&lt;input type="text" name="userid" id="userid"/&gt;
   Password&lt;input type="password" name="pswrd"/&gt;
   &lt;input type="button" onclick="check(this.form)" value="Login"/&gt;
   &lt;input type="reset" value="Reset"/&gt;
   &lt;/form&gt;
   &lt;script language="javascript"&gt;
   function check(form)
   {
  
   if(form.userid.value &amp;&amp; form.pswrd.value)
    {
  
  alert("Welcome to BOOKSIS.COM");
  var userid = document.getElementById("userid").value;
  document.write("Welcome " + userid);
  
     }
     else
     {
      alert("Error Password or Username");
      }
     }
  
     &lt;/script&gt;
     &lt;/body&gt;
     &lt;/html&gt;
  </code></pre>