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 HTML: 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> HTML: Thanx!
Hi, Bumbar, the property you need is disableD Just add one "d" at the end; Like this: getElementById['Login'].disabled=true;
I totally missed the 'disabled' problem vasago is right about the property name, but i wonder why would you need to disable the button when your check() function is working just fine for stoping the form from submition (you just need to add 'return true' as i said before)...