PDA

View Full Version : S.O.S. I wante "Form"? plz



neaen
May 13th, 2005, 08:49 PM
i wante some help here.

i wante Form in my web site (from my web site to my e-mail)?
plz help me :(

rwedge
May 14th, 2005, 03:02 AM
Here's something to get you started. A simple mailto:

<!-- Put this script in the head -->
<script type="text/javascript">
<!--
function myMail() {
var To = document.formmail.To.value;
if (!To) {
alert('You must enter an email address.');
document.formmail.To.focus();
return false;
}
var reg = "*|,\":!<>[]{}`\';()&$#%";
for (var i=0;i<To.length;i++) {
if (reg.indexOf(To.charAt(i)) != -1) {
alert('You must enter a valid address.');
document.formmail.To.focus();
return false;
}
if (!(To.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)) {
alert('You must enter a valid address.');
document.formmail.To.focus();
return false;
}
}
var msg = document.formmail.Message.value;
if (!msg) {
alert('No Message Was Entered\nEnter a Message Before Sending');
document.formmail.Message.focus();
return false;
}
if (document.formmail.Subject.value=='') document.formmail.Subject.value='WWW Form Submission';
document.formmail.action="mailto:"+To;
document.formmail.submit();
}
// -->
</script>

<!-- This form goes in the body -->

<form name="formmail" method="post" action="">
<table border="0" cellpadding="3" cellspacing="3">
<tr valign="top">
<td align="left">
<b>To: </b> </td><td align="center" colspan="2"><input type="text" name="To" size="30"></td>
</tr>
<tr valign="top">
<td align="left">
<b>Subject: </b> </td><td align="center" colspan="2"><input type="text" name="Subject" size="30"></td>
</tr>
<tr valign="top">
<td align="center" colspan="3"><textarea name="Message" cols="35" rows="5"></textarea></td>
</tr>
<tr valign="top">
<td align="center"> </td><td align="left"><input type="button" value=" Send " onClick="myMail()"></td><td align="center"><input type="reset" value=" Clear "></td>
</tr>
</table></form>




/Bob