Ciao a tutti,
ho un proglema in javaScript spero che voi mi potere auitare o suggerie qualcosa di simile.
Il mio sito non supporta asp e php
Vorrei inserire delle caselle tipo name con i seguenti dati; Via, Città, N.Teleforno, N.Fax
Spero in un vostro Aiuto
Grazie a Tutti
Il mio codice e' il seguente.
<html>
<head><script LANGUAGE="JavaScript">
<!-- Begin
function getCookie(name){
var cname = name + "=";
var dc = document.cookie;
if (dc.length > 0) {
begin = dc.indexOf(cname);
if (begin != -1) {
begin += cname.length;
end = dc.indexOf(";", begin);
if (end == -1) end = dc.length;
return unescape(dc.substring(begin, end));
}
}
return null;
}
function setCookie(name, value, expires) {
document.cookie = name + "=" + escape(value) +
((expires != null) ? "; expires=" + expires.toGMTString() : "")
+ "; path=/";
}
function setName() {
var expdate = new Date ();
expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
var prompt=i = document.Mail.name.value;
setCookie("name", i, expdate);
}
function getName() {
if(getCookie("name") != null) {
document.Mail.Name.value = getCookie("emailname");
}
}
function getInfo() {
var now= new Date();
document.Mail.Info.value = "Browser: " + navigator.userAgent;
document.Mail.Info.value += "Date:" + now;
}
function checkMultiple() {
if (getCookie("emailsent") == 'true') return true;
else return false;
}
function process() {
setCookie("emailsent", "true");
with (document.Mail) {
if (Subject.selectedIndex == 1) action = "mailto:antispammer@earthling.net?subject=TJS - Comment";
else if (Subject.selectedIndex == 2) action = "mailto:antispammer@earthling.net?subject=TJS - Question";
else if (Subject.selectedIndex == 3) action = "mailto:antispammer@earthling.net?subject=TJS - Suggestion";
else if (Subject.selectedIndex == 4) action = "mailto:antispammer@earthling.net?subject=TJS - Broken Link";
else action = "mailto:antispammer@earthling.net?subject=TJS - Other";
}
}
function formCheck() {
var passed = false;
with (document.Mail) {
if (Subject.selectedIndex == 0) {
alert("Please pick a subject.");
Subject.focus();
}
else if (Name.value == "") {
alert("Please inlcude your name.");
Name.focus();
}
else if (checkMultiple()) {
if (confirm("You just sent an e-mail from this form, are you sure you want to send another?")) {
process();
passed = true;
}
}
else {
process();
passed = true;
}
}
return passed;
}
// End -->
</script>
</head>
<body>
</p><p align="center"> </p>
<table class=normal WIDTH="96%" BORDER="0" CELLSPACING="5" CELLPADDING="5">
<tr>
<td WIDTH="100%">
<p align="center"><font FACE="Times" SIZE="3"> </font></p>
<font
FACE="ARIEL,HELVETICA" SIZE="-1"></font>
<form NAME="Mail" ACTION="mailto:antispammer@earthling.net?subject=T JS - Form"
METHOD="POST" ENCTYPE="text/plain" onSubmit="return formCheck();">
<font face="ARIEL,HELVETICA" size="-1">
<input type="hidden" name="Info" value>
</font>
<table class=normal BORDER="0" CELLPADDING="10" CELLSPACING="0">
<tr>
<td>Name:
<input TYPE="text" NAME="Name" onChange="setName()" size="20">
</td>
<td ALIGN="RIGHT">Subject:
<select NAME="Subject" size="1">
<option SELECT>Please Select A Subject</option>
<option>1. Comment</option>
<option>2. Question</option>
<option>3. Suggestion</option>
<option>4. Broken Link</option>
<option>5. None of the above</option>
</select>
</td>
</tr>
<tr>
<td COLSPAN="2">
<textarea NAME="Comments, Suggestions" COLS="50" ROWS="6">
</textarea>
</td>
</tr>
</table>
</p>
<div align="center">
<center>
<table class=normal ><font
FACE="ARIEL,HELVETICA" SIZE="-1"><font FACE="Times" SIZE="3">
<tr>
<td align="center"><input TYPE="submit" VALUE="Send"> <script LANGUAGE="JavaScript">
<!-- Begin
getInfo();
getName();
// End -->
</script></td></tr></font></font>
</table>
</center></div>
</form>
</td>
</tr>
</table>
</body>
</html>