Javascript form onsubmit calls formval(). This works i know because i pass through the function it calls. The form and everything is fine, i can run server side php to do same job. It is something in the flow and i cannot see it. maybe someone else will spot what is wrong.

The alert appears for a second and disappears. so i know the function is called, and i have placed alerts at the beginning of each major function and it appears, so it is something inside. i am teaching myself this stuff. formval() is at the bottom, logboxOn() is fine, it just displays hidden divs, i put it there for convenience so ignore that

Hope someone can see something

<script type="text/javascript">

function logboxOn() {
document.getElementById( 'login-box' ).style.visibility = 'visible';
}

function vemail(){
var errstat = false;
var emailrgx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
if (document.tulogin.usname.value.search(emailrgx) == -1) {
errstat = false;
alert("Please enter a valid email address.");
}else{
errstat = true;
}
return errstat;
}

function valname1() {
var errstat = false;
var entname = document.tulogin.usname.value;
if (entname == 'email@abc.com') {
alert('email@abc.com is an invalid user');
errstat = false;
}else{
errstat = true;
}
if (errstat == true ) {
errstat = vemail();
}
return errstat;
}

function valpass() {
var errstat = false;
var taglen = document.tulogin.upasswd.value.length;
var tagval = document.tulogin.upasswd.value;
if( taglen < 6 || taglen > 15 ){
errstat = false;
alert('Password must be 6 to 15 characters');
}else{
if (tagval.match(/^[a-zA-Z0-9]+$/)) {
errstat = false;
alert('Invalid password entered');
}else{
errstat = true;
}
}
return errstat;
}

function formval() {
var errstat = false;
if (valname1()) {
if (valpass()) {
errstat = true;
alert('You found the lucky egg');
}else{
errstat = false;
}
}else{
errstat = false;
alert('Houston, we have a problem. Something is wrong, i know it is??');
}
if (errstat == -1) {
window.location = 'index.html';
}else{
window.location = 'tu.html';
}
}

</script>

________________________________________

Roy Lister - http://www.reallymisfit.com
________________________________________
Adelaide, South Australia
all things Photography & Linux