Hello, I made a simple script which will clear the text boxes when you click on it so you can type in it and also will disable the submit button, untill those fiellds are filled in. The script could be a lot shorter but "OR" didn't work in my script, and I'm kinda new to javascript caus I kinda started learning it about... yesterday xD anyways xD here it is:
Quote:
<html>
<head>
<script language="javascript">
function check() {
if(document.login.user.value != "username") {
if(document.login.user.value != "") {
if(document.login.pass.value != "" ) {
if(document.login.pass.value != "password") {
document.login.submit.disabled = "";
}
}
}
}
if(document.login.user.value == "" ) {
document.login.submit.disabled = "enabled";
}
if(document.login.user.value == "username") {
document.login.submit.disabled = "enabled";
}
if(document.login.pass.value == "password") {
document.login.submit.disabled = "enabled";
}
if(document.login.pass.value == "") {
document.login.submit.disabled = "enabled";
}
}
</script>
</head>
<body>
<form name="login" OnClick="check();">
<input type="text" name="user" value="username" OnClick="check(); if(this.value == 'username') { this.value = '' }" OnChange="check();" OnBlur="check();" onkeyup="check();">
<input type="password" name="pass" value="password" OnClick="check(); if(this.value == 'password') { this.value = '' } " OnChange="check();" OnBlur="check();" onkeyup="check();">
<input type="submit" value="login" name="submit" disabled="check();" OnClick="check();" OnBlur="check();" OnChange="check();">
</form>
</body>
</html>
|
Don't have the time at the moment to explain the things, will edit the post later

have fun with it

and btw, if you want to let it return the value of the fields to 'username' and 'password' once the user clicks somewhere else then in one of the fields, then you can also combine it with the clearing form script from FTH8er
Greetz ^^