login form in javascript code example

Example 1: how to make a html login page

<!doctype html>
<form name="loginForm" method="post" action="index.html">
<table width="20%" bgcolor="0099CC" align="center">
  <tr>
<td colspan=2><center><font size=4><b>light-net login</b></font></center></td>
</tr>

<tr>
<td>Username:</td>
<td><input type="text" size=25 name="user"></td>
</tr>

<tr>
<td>Password:</td>
<td><input type="Password" size=25 name="pass"></td>
</tr>

<tr>
<td ><input type="Reset"></td>
<td><input type="submit" onclick="return check(this.form)" value="Login"></td>
</tr>

</table>
</form>
<script language="javascript">
function check(form)
{

if(form.user.value == "public" && form.pass.value == "peasants")
{
	return true;
}
else
{
	alert("Error Password or Username")
	return false;
}
}
	      </script>

Example 2: login page code in javascript

<!DOCTYPE html>
  <html>
  <head>
  <title>Welcome To Login Form</title>
  </head>

	<body>
	<!-- Main div code -->
	<div id="main">
	<div class="h-tag">
	<h2>Welcome To My Account Login</h2>
	</div>
	<!-- Login box -->
	<div class="login">
	<table cellspacing="2" align="center" cellpadding="8" border="0">
	<tr>
	<td>Enter User Name :</td>
	<td><input type="text" placeholder="Enter user name here" id="email" class="tb" /></td>
	</tr>
	<tr>
	<td>Enter Password :</td>
	<td><input type="password" placeholder="Enter Password here" id="pwd1" class="tb" /></td>
	</tr>
	<tr>
	<td></td>
	<td>
	<input type="submit" value="Reset" onclick="clearFunc()" class="btn" />
	<input type="submit" value="Login" class="btn" onClick="login()" /></td>
	</tr>
	</table>
	</div>
  	 <!-- login box div ending here.. -->
	</div>
	<!-- Main div ending here... -->
    
  </body>
  </html>

Example 3: html login scripts

<form action="action_page.php" method="post">
  <div class="imgcontainer">
    <img src="img_avatar2.png" alt="Avatar" class="avatar">
  </div>

  <div class="container">
    <label for="uname"><b>Username</b></label>
    <input type="text" placeholder="Enter Username" name="uname" required>

    <label for="psw"><b>Password</b></label>
    <input type="password" placeholder="Enter Password" name="psw" required>

    <button type="submit">Login</button>
    <label>
      <input type="checkbox" checked="checked" name="remember"> Remember me
    </label>
  </div>

  <div class="container" style="background-color:#f1f1f1">
    <button type="button" class="cancelbtn">Cancel</button>
    <span class="psw">Forgot <a href="#">password?</a></span>
  </div>
</form>

Example 4: html password and username

#Check the above or below to know.

Tags:

Html Example