.רתויב בושח טפירקס
םיפסונ םירוקיבב םיטרפה יולימל זיקוקב שמתשמ רכוזה ספוטה

NFL Commerative Stamps Order Form:

Name:
Address:
City:
Zip Code:  
Phone:

 
<html>
<head>
<title></title>

<SCRIPT language=JavaScript1.2>

// Determine if browser can run this script.

var capable;
var name = navigator.appName.toLowerCase();
var vers = parseFloat(navigator.appVersion);

if ((name.indexOf("netscape") >= 0 && vers >= 4) || (name.indexOf("microsoft") >= 0 && vers >= 4))
capable = true;
else
capable = false;

// Constants.

var FLDSEP; // Special characters used as separators in cookie data string.
var IDXSEP;

if (capable) {
FLDSEP = String.fromCharCode(1);
IDXSEP = String.fromCharCode(2);
}

//----------------------------------------------------------------------------
// Stores data currently entered on a form as cookies. Always returns true.
//
// name - The form name.
// days - Number of days to keep the cookies.
// exclude - A comma-delimited list of field names that should not be
// stored. Use to exclude sensitive data such as password,
// credit card numbers, etc.
//----------------------------------------------------------------------------

function storeData(name, days, exclude) {

var f;
var expdate;
var list, include;
var i;
var fld;
var data;

if (!capable)
return true;

// Get the named form, skip processing if not found.

if (!(f = document.forms[name]))
return true;

// Initialize the data field.

// Set the expiration date.

if (days == "")
days = 0;
expdate = new Date();
expdate.setTime (expdate.getTime() + (86400 * 1000 * days));

// Build a list of field names for exclusion.

list = new Array();
if (exclude != "") {
i = 0;
while ((i = exclude.indexOf(",")) >= 1) {
list[list.length] = exclude.substr(0, i);
exclude = exclude.substr(i + 1)
}
list[list.length] = exclude;
}

// Run through the fields and add field name/value pairs to the data string.

data = FLDSEP;
for (i = 0; i < f.length; i++) {
fld = f.elements[i];

// Is field in exclusion list?

include = true;
for (j = 0; j < list.length; j++)
if (fld.name == list[j])
include = false;

if (include) {

// Checkboxes and radio buttons.

if ((fld.type == "checkbox" || fld.type == "radio") && fld.checked)
data += setData(fld.name, fld.value);

// Selection lists (single).

if (fld.type == "select-one")
if (fld.selectedIndex >= 0)
data += setData(fld.name, fld.options[fld.selectedIndex].value);

// Selection lists (multiple). Add a unique name/value pair for each selected item.

if (fld.type == "select-multiple")
for (j = 0; j < fld.options.length; j++)
if (fld.options[j].selected)
data += setData(fld.name + IDXSEP + j, fld.options[j].value);

// Text fields.

if (fld.type == "hidden" || fld.type == "password" || fld.type == "text" || fld.type == "textarea")
data += setData(fld.name, fld.value);
}
}

// Set the cookie.

deleteCookie(name);
setCookie(name, data, expdate);

return true;
}

//----------------------------------------------------------------------------
// Retrieves data from the cookie and sets the values in the corresponding
// form fields. Returns true if data was found, false otherwise.
//
// name - The form name.
//----------------------------------------------------------------------------

function retrieveData(name) {

var f;
var i, j;
var fld;
var s;
var data;

if (!capable)
return false;

// Get the named form, return if not found.

if (!(f = document.forms[name]))
return false;

// Get the cookie for this form.

data = getCookie(name);
if (data == "")
return false;

// Run through the fields and retrieve the values.

for (i = 0; i < f.elements.length; i++) {
fld = f.elements[i];

// Checkboxes and radio buttons.

if ((fld.type == "checkbox" || fld.type == "radio") && (s = getData(fld.name, data)) != null && fld.value == s)
fld.checked = true;

// Selection lists (single).

if (fld.type == "select-one" && (s = getData(fld.name, data)) != null)
for (j = 0; j < fld.options.length; j++)
if (fld.options[j].value == s)
fld.options[j].selected = true;

// Selection lists (multiple).

if (fld.type == "select-multiple")
for (j = 0; j < fld.options.length; j++)
if ((s = getData(fld.name + IDXSEP + j, data)) != null && fld.options[j].value == s)
fld.options[j].selected = true;

// Text fields.

if ((fld.type == "hidden" || fld.type == "password" || fld.type == "text" || fld.type == "textarea") && (s = getData(fld.name, data)) != null)
fld.value = s;
}

return true;
}

/*****************************************************************************
* These functions set and retrieve the field name/value pairs stored in the *
* cookie. *
*****************************************************************************/

//----------------------------------------------------------------------------
// Given a field name and value, creates a name/value string that can be
// appended to the cookie data. A null string is returned if the given value
// is null.
//----------------------------------------------------------------------------

function setData(name, value) {

if (value != "")
return name + "=" + value + FLDSEP;
else
return "";
}

//----------------------------------------------------------------------------
// Given a field name, this function will extract the matching value found
// in the data string. Null is returned if no match is found.
//----------------------------------------------------------------------------

function getData(name, data) {

var i, j;
var s;

if (data == "")
return null;

s = FLDSEP + name + "=";
i = data.indexOf(s);
if (i >= 0) {
i += s.length;
j = data.indexOf(FLDSEP, i);
if (j >= 0)
return data.substr(i, j - i);
}

return null;
}

/*****************************************************************************
* These are the basic functions to set, get and delete a cookie. *
*****************************************************************************/

//----------------------------------------------------------------------------
// Set a cookie given a name, value and expiration date.
//----------------------------------------------------------------------------


function setCookie (name, value, expires) {

document.cookie = name + "=" + escape(value) + "; expires=" + expires.toGMTString() + "; path=/";
}

//----------------------------------------------------------------------------
// Returns the value of the named cookie.
//----------------------------------------------------------------------------

function getCookie(name) {

var search;

search = name + "="
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length ;
end = document.cookie.indexOf(";", offset) ;
if (end == -1)
end = document.cookie.length;
return unescape(document.cookie.substring(offset, end));
}
else
return "";
}

//----------------------------------------------------------------------------
// Delete the named cookie.
//----------------------------------------------------------------------------

function deleteCookie(name) {

var expdate = new Date();
expdate.setTime(expdate.getTime() - (86400 * 1000 * 1));
setCookie(name, "", expdate);
}

</SCRIPT>


</head>

<body onload="retrieveData('myForm')" >

<FORM action="mailto:info@you.com" enctype=text/plain method=post name=myForm onsubmit="storeData(this.name, 90, 'cardnum,cardexp'); alert('Form \'submitted.\''); return true;">

<HR noShade>
<FONT size=3><B>NFL Commerative Stamps Order Form:</B></FONT>
<P>
<TABLE border=0 cellPadding=2 cellSpacing=0>
<TBODY>
<TR vAlign=bottom>
<TD><FONT face=Arial,Helvetica size=2><B>Name:</B></FONT></TD>
<TD colSpan=3>
<INPUT name=custname size=30>
</TD>
</TR>
<TR vAlign=bottom>
<TD><FONT face=Arial,Helvetica size=2><B>Address:</B></FONT></TD>
<TD colSpan=3>
<INPUT name=address size=30>
</TD>
</TR>
<TR vAlign=bottom>
<TD><FONT face=Arial,Helvetica size=2><B>City:</B></FONT></TD>
<TD colSpan=3>
<INPUT name=city size=15>
</TD>
<TR>
<TR vAlign=bottom>
<TD><FONT face=Arial,Helvetica size=2><b>Zip Code:</b></FONT></TD>
<TD>
<input maxlength=5 name=zip size=5>
</TD>
<TD><FONT face=Arial,Helvetica size=2></FONT></TD>
<TD>&nbsp; </TD>
</TR>
<TR>
<TD><FONT face=Arial,Helvetica size=2><B>Phone:</B></FONT></TD>
<TD>
<INPUT name=phone size=12>
</TD>
</TR>
</TBODY>
</TABLE>
<P>
<INPUT type=submit value=Submit>
<INPUT type=reset value=Clear>
</FORM>
</body>
</html>