阻止同一用户注册

大家好,
我一直致力于这项任务,以完成以下工作:
1.修改原型,以便在验证所有字段后,将Cookie添加到用户的计算机中.
2.阻止同一用户注册,并将他们定向到一个单独的HTML页面,通知他们已经提交了表格.
这就是我到目前为止写的,但似乎无法让它工作…我是否将其合并到我现有的html表单页面中?

选择 | 换行 | 行号
  1. document.cookie = encodeURI("lname=" + document.forms[0].lname.value);
  2. document.cookie = encodeURI("&fname=" + document.forms[0].fname.value);
  3. document.cookie = encodeURI("&addressone=" + document.forms[0].addressone.value);
  4. document.cookie = encodeURI("&city=" + document.forms[0].city.value);
  5. document.cookie = encodeURI("&state=" + document.forms[0].state.value);
  6. document.cookie = encodeURI("&zip=" + document.forms[0].zip.value);
  7. document.cookie = encodeURI("&emailaddress=" + document.forms[0].email.value);
  8. document.cookie = encodeURI("&area=" + document.forms[0].exchange.value);
  9. document.cookie = encodeURI("&exchange=" + document.forms[0].area.value);
  10. document.cookie = encodeURI("&phone=" + document.forms[0].phone.value);
  11.  

如有任何建议,我们将不胜感激……谢谢……

# 回答1


请参见How to Read/Set/Delete Cookie
这里
.首先,阅读Cookie,如果它存在,则重定向.如果不是并且信息是提交的,则设置Cookie.

标签: Javascript

添加新评论