In my website I have a box that is not displayed. When the user types his username and password, if they are correct, the box must be displayed. Here you see the HTML code:
<div id="mainbox" style="display: none;">
<p class="classm">Test.</p>
</div>
<input type="text" id="user"/>
<br />
<input type="text" id="password" value="a"/>
<br />
<input type="button" value="Log in" onclick="login();">
And here the javascript function:
function login() {
var a = document.getElementById('password').value;
var b = document.getElementById('user').value;
if ((a == 'qwe') && (b == 'rty')) { //the problem is not here
document.getElementById('password').style.display="none";
}
else
{
alert('You are not logged in.');
}
}
When I click the button Log in looks like the function login(); is not called because anything happen. Do you know why?