Jump to content

stupid cookies


Guest atmosphere

Recommended Posts

Guest atmosphere
<html><head><script>function cookietest()   {	var juser = getCookie("user");	var jaddr = getCookie("addr");	var jtel = getCookie("tel");	var jsal = getCookie("sal");	if (juser != null)  {    myform.user.value = juser;  }	if (jaddr != null)  {    myform.addr.value = jaddr;  }	if (jtel != null)  {    myform.tel.value = jtel;  }	if (jsal != null)  {    myform.sal.value = jsal;  }   }function check()   {	jstatus=true;	if(myform.user.value=="")   {  jstatus=false;  alert ("You forgot to fill in a part");   }	return jstatus;//*   var yrname, abc;   yrname=getCookie("nom");   if(yrname==null)   {     abc=prompt("Who are you?");     setCookie("nom",abc,365);   }   else   {     alert("Hello " + yrname);*//   }   }function setCookie(c_name,value,expiredays)	{   var exdate=new Date()   exdate.setTime(exdate.getTime()+(expiredays*24*3600*1000))    document.cookie=c_name+ "=" +escape(value)+    ((expiredays==null) ? "" : "; expires="+exdate)	}function getCookie(c_name)	{    if (document.cookie.length>0)    {          c_start=document.cookie.indexOf(c_name + "=")          if (c_start!=-1)          {               c_start=c_start + c_name.length+1               c_end=document.cookie.indexOf(";",c_start)              if (c_end==-1) c_end=document.cookie.length              return unescape(document.cookie.substring(c_start,c_end))         }     }   return null	}</script></head><body onLoad="cookietest();" onSubmit="return check();"><form id="myform">Name <input type="text" name="user"><br>Address <input type="text" name="addr"><br>Telephone Number <input type="text" name="tel"><br>Salary <input type="text" name="sal"><br><input type="submit" value="submit"></form></body>

I need this to happen:You are to create a web page that uses expiry cookies. The function of the cookie will be to save the user’s information including:User’s NameUser’s Address (including city and postal code)User’s Telephone number.User’s SalaryMake this cookie last 20 days• If the cookie exists, do not ask the user for this information, however, check the person’s salary:o if it is over $20000 per year, pop up a window showing www.ford.como If the salary is $20000 per year or less, pop up a window showing www.disney.com• If the cookie does not exist, then ask for all the information, and do not pop up any windows. However, you should display the person’s name in your page in a welcome back messageThis page is very plain and contains two objects:• An input text box where the user will type in his age• A button that will submit the form and run php script on the serverThis page also contains some javascript that ensures the age is not blank before the information is submitted to the serverThe php script will do the following:o If the user’s age is below 18, it will generate a very simple page saying “you are a minor, and have to wait XX years until you are an adult” - where XX is how many years the person is below 18 years o If the person is 18 or above, generate a page saying “You are an adult”Can anyone help me here I'm *BEEPED BY CHOCO* lost..Just for the record I didn't build that code, someone else did, so I'm extremely lost.Thanks so much.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...