Javascript Validation
Modify this code so that when a user puts a mouse on the submit button, the value of the button change to “Click to Send” and back to the default value if the user removes the mouse from the button.
<script language=javascript>[STEP BY STEP]
function verify(){
var inputname = document.form1.myname.value;
if(inputname=="")
{
alert("please enter a name in the field");
return false;
}if(inputname.length==1)
{
alert("The name cannot be 1 letter only.");
return false;
}
else {
return true;
}
}
</script>
<form name="form1" action ="a.php" onsubmit="return verify()">
name: <input type=text name="myname" size=30><br>
<input type="submit" name = 'btn' value="Send">
</form>
Zuletzt geändert: Sunday, 10. February 2019, 10:19