Poniżej przedstawiam kod do prostego formularza służącego do przesłania zapytania ze strony internetowej. Składa on się z dwóch części:
<script type="text/javascript">
// <![CDATA[
function sprawdz(formularz)
{
for (i = 0; i < formularz.length; i++)
{
var pole = formularz.elements[i];
if ((pole.type == "text" || pole.type == "text" || pole.type == "textarea") && pole.value == "")
{
alert("Proszę wypełnić wszystkie pola!");
return false;
}
}
return true;
}
// ]]>
</script>
<form action="mailto:twoj_email?subject=twoja_nazwa" method="post" enctype="text/plain" onsubmit="if (sprawdz(this)) return true ; return false">
<legend><b>Twoje pytanie</b></legend>
<div style="overflow: hidden; clear: left; margin-bottom: 0.5em">
<label style="width: 60px; float: left; margin: 5px 0 5px 40px;" for="fNick">Nick</label> <input style="float: left" id="fNick" name="fNick" class="text" type="text" />
</div>
<div style="overflow: hidden; clear: left; margin-bottom: 0.5em">
<label style="width: 60px; float: left; margin: 5px 0 5px 40px;" for="fMail">Mail</label> <input style="float: left" id="fMail" name="fMail" class="text" type="text" />
</div>
<div style="overflow: hidden; clear: left; margin-bottom: 0.5em">
<label style="width: 60px; float: left; margin: 5px 0 5px 40px;" for="fText">Treść</label>
<textarea style="float: left; width:20em" id="fText" name="fText" cols="40" rows="10">
</textarea>
</div>
<div style="overflow: hidden; clear: left; margin-bottom: 0.5em">
<input style="float: left; margin: 5px 0 5px 100px;" id="fSubmit" name="fSubmit" class="submit" type="submit" value="Wyślij" />
</div>
Powyższy kod należy skopiować i wkleić do swojej strony, gdzie:
twoj_email - wpisz swój email,
twoja_nazwa - wpisz swoją nazwę, która pojawi się w temacie wiadomości.
Formularz został stworzony w stylu kaskadowym CSS, na podstawie wiadomości z serwisu Kurs tworzenia stron WWW, gdzie można znaleźć obszerne wiadomości na temat budowy stron internetowych.