I'm still new to javascript and I would appreciate any help.
I'm using the action=mailto:email@com to see if my form works correctly. When I submit the form, instead of sending the form to the email address, it opens a blank email page. Why? Is it because of MSIE 6? Please help!
Here is the script below:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript" type="text/javascript">
<!--
function myValid(){
if(document.myForm.first_name.value==""){
alert("Please enter your first name!")
document.myForm.first_name.focus()
return false
}
if(document.myForm.last_name.value==""){
alert("Please enter your last name!")
document.myForm.last_name.focus()
return false
}
if(document.myForm.company.value==""){
alert("Please enter your company's name!")
document.myForm.company.focus()
return false
}
if(document.myForm.address.value==""){
alert("Please enter your address!")
document.myForm.address.focus()
return false
}
if(document.myForm.city.value==""){
alert("Please enter your city!")
document.myForm.city.focus()
return false
}
if(document.myForm.zipCode.value==""){
alert("Please enter your zip code!")
document.myForm.zipCode.focus()
return false
}
if(document.myForm.state.value==""){
alert("Please enter your state!")
document.myForm.state.focus()
return false
}
if(document.myForm.country.value==""){
alert("Please enter your country!")
document.myForm.country.focus()
return false
}
if(document.myForm.email.value==""){
alert("Please enter your email address!")
document.myForm.email.focus()
return false
}
return true
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF">
<form name="myForm" method="post" onSubmit="return myValid()" action="mailto:[email protected]" ENCTYPE="text/plain">
<table width="566" border="0" cellspacing="2" cellpadding="2" align="center">
<tr>
<td>
<div align="center"><font face="Arial, Helvetica, sans-serif" size="2" color="#FF0000">First
Name: </font> <font color="#FF0000">
<input type="text" name="first_name" size="30" maxlength="30">
<font size="2" face="Arial, Helvetica, sans-serif">Last Name: </font></font>
<font color="#FF0000">
<input type="text" name="last_name" size="30" maxlength="30">
<br>
<font face="Arial, Helvetica, sans-serif" size="2">Company Name:
<input type="text" name="company" size="30" maxlength="30">
<br>
Address:
<input type="text" name="address" size="30" maxlength="30">
City:
<input type="text" name="city" size="30" maxlength="30">
<br>
Zip Code:
<input type="text" name="zipCode" size="5" maxlength="10">
State:
<input type="text" name="state" size="2" maxlength="2">
Country:
<input type="text" name="country" size="25" maxlength="40">
</font></font> <font color="#FF0000"><br>
<font face="Arial, Helvetica, sans-serif" size="2">Email: </font></font>
<font color="#FF0000">
<input type="text" name="email" size="30" maxlength="40">
</font> <br>
<input type="submit" name="Submit" value=http://www.webdeveloper.com/forum/archive/index.php/"Submit">
<input type="reset" name="Reset" value="Reset">
<input type="button" name"Valid" value="Valid">
</div>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</form>
</body>
</html>
I'm using the action=mailto:email@com to see if my form works correctly. When I submit the form, instead of sending the form to the email address, it opens a blank email page. Why? Is it because of MSIE 6? Please help!
Here is the script below:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript" type="text/javascript">
<!--
function myValid(){
if(document.myForm.first_name.value==""){
alert("Please enter your first name!")
document.myForm.first_name.focus()
return false
}
if(document.myForm.last_name.value==""){
alert("Please enter your last name!")
document.myForm.last_name.focus()
return false
}
if(document.myForm.company.value==""){
alert("Please enter your company's name!")
document.myForm.company.focus()
return false
}
if(document.myForm.address.value==""){
alert("Please enter your address!")
document.myForm.address.focus()
return false
}
if(document.myForm.city.value==""){
alert("Please enter your city!")
document.myForm.city.focus()
return false
}
if(document.myForm.zipCode.value==""){
alert("Please enter your zip code!")
document.myForm.zipCode.focus()
return false
}
if(document.myForm.state.value==""){
alert("Please enter your state!")
document.myForm.state.focus()
return false
}
if(document.myForm.country.value==""){
alert("Please enter your country!")
document.myForm.country.focus()
return false
}
if(document.myForm.email.value==""){
alert("Please enter your email address!")
document.myForm.email.focus()
return false
}
return true
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF">
<form name="myForm" method="post" onSubmit="return myValid()" action="mailto:[email protected]" ENCTYPE="text/plain">
<table width="566" border="0" cellspacing="2" cellpadding="2" align="center">
<tr>
<td>
<div align="center"><font face="Arial, Helvetica, sans-serif" size="2" color="#FF0000">First
Name: </font> <font color="#FF0000">
<input type="text" name="first_name" size="30" maxlength="30">
<font size="2" face="Arial, Helvetica, sans-serif">Last Name: </font></font>
<font color="#FF0000">
<input type="text" name="last_name" size="30" maxlength="30">
<br>
<font face="Arial, Helvetica, sans-serif" size="2">Company Name:
<input type="text" name="company" size="30" maxlength="30">
<br>
Address:
<input type="text" name="address" size="30" maxlength="30">
City:
<input type="text" name="city" size="30" maxlength="30">
<br>
Zip Code:
<input type="text" name="zipCode" size="5" maxlength="10">
State:
<input type="text" name="state" size="2" maxlength="2">
Country:
<input type="text" name="country" size="25" maxlength="40">
</font></font> <font color="#FF0000"><br>
<font face="Arial, Helvetica, sans-serif" size="2">Email: </font></font>
<font color="#FF0000">
<input type="text" name="email" size="30" maxlength="40">
</font> <br>
<input type="submit" name="Submit" value=http://www.webdeveloper.com/forum/archive/index.php/"Submit">
<input type="reset" name="Reset" value="Reset">
<input type="button" name"Valid" value="Valid">
</div>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</form>
</body>
</html>