Write a JavaScript program to create a form having username and password and save the password in cookie.
Write a webpage that displays a form that contains an input for username and password. user is prompted to enter the input and password and password becomes value of the cookie. Write the JavaScript function for storing the cookie . it gets executed when the password changes.
<html>
<head>
<title>Store Cookie password</title>
<script>
function storeCookie()
{
var pwd = document.getElementById('pwd').value
document.cookie = "Password=" + pwd + ";"
alert("Cookie Stored\n" + document.cookie)
}
</script>
</head>
<body>
<form name="myForm">
Enter Username <input type="text" id="uname"/><br/>
Enter Password <input type="password" id="pwd"/><br/>
<input type="button" value="Submit" onclick="storeCookie()"/>
</form>
<p id="panel"></p>
</body>
</html>
