Good day every body, this my script can submit form inputs to email.but i wants it to equally display another page on submit.to this effect i have add this code below to the body of the main code but its not working.U can see where i added it at bottom of the body element
<body onsubmit="javascript:window.location.href='dload.html';">
here is the main code. thanks
<html><head><title>gggggg</title>
<script type="text/javascript">
function clear_field(field)
{
if (field.value==field.defaultValue)
{
field.value=''
}
}
// Checks field to see if any information was entered. If not, the default value is reentered.
function check_field(field)
{
if (field.value=='' ||
field.value==' ')
{
field.value=field.defaultValue
}
}
// Validates the form. If a field fails the validation, The form is not submitted.
function validate_form()
{
// Validates the name field.
if (document.jsform.lastname.value==document.jsform.lastname.defaultValue ||
document.jsform.lastname.value.indexOf(' ',0)==0)
{
alert('\nNo lastname entered.')
document.jsform.lastname.select()
document.jsform.lastname.focus()
return false
}
// Validates the firstname field.
if (document.jsform.firstname.value==document.jsform.firstname.defaultValue ||
document.jsform.lastname.value.indexOf(' ',0)==0)
{
alert('\nNo firstname entered.')
document.jsform.firstname.select()
document.jsform.firstname.focus()
return false
}
// Validates the email field.
if (document.jsform.email.value==document.jsform.email.defaultValue)
{
alert('\nNo email address entered.')
document.jsform.email.select()
document.jsform.email.focus()
return false
}
if (document.jsform.email.value.indexOf('@',0)==-1 ||
document.jsform.email.value.indexOf('.',0)==-1)
{
alert('\nInvalid email address.')
document.jsform.email.select()
document.jsform.email.focus()
return false
}
// Validates the comments field.
if (document.jsform.COMMENTS.value==document.jsform.COMMENTS.defaultValue ||
document.jsform.COMMENTS.value.indexOf(' ',0)==0)
{
alert('\nNo COMMENTS entered.')
document.jsform.COMMENTS.select()
document.jsform.COMMENTS.focus()
return false
}
// Validates the gender field.
if (document.jsform.gender.value==document.jsform.gender.defaultValue ||
document.jsform.gender.value.indexOf(' ',0)==0)
{
alert('\nNo gender entered.')
document.jsform.gender.select()
document.jsform.gender.focus()
return false
}
// Validates the select field.
if (document.jsform.copy.value==document.jsform.copy.defaultValue ||
document.jsform.copy.value.indexOf(' ',0)==0)
{
alert('\nNo answer entered.')
document.jsform.copy.select()
document.jsform.copy.focus()
return false
}
// Prompts user for confirmation
else
{
if(confirm('\nClick the OK button to send this form via email.'))
{
return true
}
else
{
return false
}
}
}
</SCRIPT>
</head>
<font color=green>
<fieldset><legend>USERS COMMENTS</legend>
<FORM NAME='jsform' METHOD='post' ENCTYPE='text/plain' ACTION='mailto:esedofred@yahoo.com?subject=hello esedo' onSubmit='return validate_form()'>
<INPUT NAME='lastname' TYPE='text' VALUE='your lastname' SIZE='50' onFocus='clear_field(this)' onBlur='check_field(this)'></br>
<INPUT NAME='firstname' TYPE='text' VALUE='your firstname' SIZE='50' onFocus='clear_field(this)' onBlur='check_field(this)'></br>
<INPUT NAME='email' TYPE='text' VALUE='Email address' SIZE='50' onFocus='clear_field(this)' onBlur='check_field(this)'></br>
<TEXTAREA NAME="COMMENTS" ROWS=6 COLS=38 VALUE='your comment' onFocus='clear_field(this)' onBlur='check_field(this)'></TEXTAREA></br>Enter your comments in the box provided.</br>
<INPUT NAME='gender' TYPE='text' VALUE='gender' SIZE='5' onFocus='clear_field(this)' onBlur='check_field(this)'></br>
Do you like our site </br>
<SELECT NAME='Copy'>
<OPTION SELECTED VALUE='yes'>yes
<OPTION VALUE='no'>no</SELECT>
<INPUT TYPE='submit' VALUE='Submit'>
<INPUT TYPE='reset' VALUE='Reset'></br>
</FORM>
</fieldset>
if you made any mistake click on RESET BUTTON to refresh.
</font>
<body onsubmit="javascript:window.location.href='dload.html';">
</body>