I have been working on a simple login page where I accept values and print them back. I have written a function in javascript to store input values from text box. I have added two print statements to just check till where my program works. Here is my script.
<html>
<head>
<link href='http://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
<meta charset="UTF-8">
<title>Home| Login</title>
</head>
<body>
<script type="text/javascript">
function init() {
document.write("Reached Point 1");
document.write(document.getElementById("username").value);
var password = document.getElementById("password").value;
document.write("Reached Point 2");
}
</script>
<div class="logo"></div>
<div class="login-block">
<h1>Login</h1>
<input type="text" value="" id="username" />
<input type="text" value="" id="password" />
<button onclick="init()">Submit</button>
</div>
</body>
</html>
Reached Point 1 is getting printed on clicking the button but the username and Reached Point 2 are not getting printed.