Last active
March 26, 2016 13:50
-
-
Save JarvusChen/8a71e4d611d6fde1c52f to your computer and use it in GitHub Desktop.
PHP form DEMO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
function checkFunc(){ | |
var f = document.form.check; | |
var b = document.form.YourName; | |
if (b.value == ""){ | |
alert("請填寫姓名") | |
return false; | |
} | |
if (f.checked){ | |
}else{ | |
alert("請打勾") | |
return false; | |
} | |
if (b.value != null && f.checked){ | |
return true; | |
} | |
} | |
</script> | |
<form name="form" method="post" action="finished.php" onsubmit="return checkFunc();"> | |
<input style="width:100px" type="text" name="YourName"> | |
<input type="checkbox" name="check"> | |
<input type="submit" name="submit" value="送出"> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment