here is the answer cookies login logout info question

first, use javascript the innerHTML create a html_login and log_out page(actional this not a page ,just 2 div),when validate pass then get in show this div info “welcom back use + logout button or a linked paragraph” something like this.

second. ease,you validate the page,for assessment only need validate not empty. For the real world you will go to the database check the info. if not empty, then store the info to document.cookie=txtuser.value + “|” + txtuser.value+’@tafensw.edu’;

third. in you login_div, you just use this info:

here is the code:

var tname=document.getElementById(“txtname”);
    if(tname)tname.value=udata[0];//write into txtname box
    var temail=document.getElementById(“txtemail”);
    if(temail)temail.value=udata[1];//write into txtemail box

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s