usiski
01 Apr 2010, 06:53 PM
I was wondering whats wrong with my script because its not working and i can't figure it out? I had just the email part first and that was working then I added the other stuff to check the rest and now none of it works. I only works with just the email validation.
Any help will be appreciated, thanks.
<script type="text/javascript">
function checkForm()
{
var cname, cmessage,
with(window.document.contact)
{
cname = name;
cmessage = message;
}
if(cname.value == '')
{
alert('Please enter your name!');
cname.focus();
return false;
}
if (cmessage.value == '')
{
alert('Please enter your first name!');
cmessage.focus();
return false;
}
}
<!--
function emailcheck(cur)
{
var string1=cur.email.value
if (string1.indexOf("@")==-1)
{
alert("Please input a valid email address!")
return false
}
}
//-->
</script>
Any help will be appreciated, thanks.
<script type="text/javascript">
function checkForm()
{
var cname, cmessage,
with(window.document.contact)
{
cname = name;
cmessage = message;
}
if(cname.value == '')
{
alert('Please enter your name!');
cname.focus();
return false;
}
if (cmessage.value == '')
{
alert('Please enter your first name!');
cmessage.focus();
return false;
}
}
<!--
function emailcheck(cur)
{
var string1=cur.email.value
if (string1.indexOf("@")==-1)
{
alert("Please input a valid email address!")
return false
}
}
//-->
</script>