bumbar
Sep 1st 2008, 2:33 am
Hallo!
Is it possible for the button for the sending only to be activated if the all fields to be completed?
I think that must be used getElementById['Login'].disable=true
But it is not obviously how... :(
Here the code:
<script type="text/javascript">
function check()
{
if(document.getElementById("username").value=="")
{
alert("Please, type username!");
return false
}
if(document.getElementById("password").value=="")
{
alert("Please, type password!");
return false
}
}
</script>
<form id="form1" name="form1" method="post" action="" onsubmit="return check()">
<label> Username:
<input type="text" name="username" id="username" />
<br />
Password:
<input type="text" name="password" id="password" />
<br />
<input type="submit" name="Login" id="Login" value="Submit" />
</label>
</form>
Thanx!
Is it possible for the button for the sending only to be activated if the all fields to be completed?
I think that must be used getElementById['Login'].disable=true
But it is not obviously how... :(
Here the code:
<script type="text/javascript">
function check()
{
if(document.getElementById("username").value=="")
{
alert("Please, type username!");
return false
}
if(document.getElementById("password").value=="")
{
alert("Please, type password!");
return false
}
}
</script>
<form id="form1" name="form1" method="post" action="" onsubmit="return check()">
<label> Username:
<input type="text" name="username" id="username" />
<br />
Password:
<input type="text" name="password" id="password" />
<br />
<input type="submit" name="Login" id="Login" value="Submit" />
</label>
</form>
Thanx!