<script type="text/javascript" src="js/js01.js"></script>
<!-- ... -->
<form id="frmReg" method="post" onsubmit="valRegs()" action="memb_area/register.php">
Why the function valRegs() (code is placed inside js01.js file) is not executed, except I drag the code inside html file ?
How can I be sure that valRegs() is always executed before and not after code inside register.php file ?
By making sure that the script with your validation is below the form in your html.
This is because you are trying to bind to a non-existent element when the script runs.
Alternatively you should wrap your script inside a jQuery
$(document).ready()or by creating an onload function.