You may write this program in one .html document, and you do not have to use any
ID: 3891858 • Letter: Y
Question
You may write this program in one .html document, and you do not have to use any prior programs’ code. Write a web page that uses cookies to store the date and time of your last visit.
var now = new Date();
var day = now.getDay():
var date = now.getDate();, and so forth.
Note: You do not have to open a prior exercise to complete this.
0 ecpi.instructure.com á a lofts coursehero bmw DLZV Shizzy Musica v Back2ballin v Yahoo! Amazon.com Ebay Navyfed YouTube Apple Xfit Bodybuilding.com 12-Week Hard...Kris Gethin! Unit 4 Graded Exercise 1: Create a Cookies Program that Stores the Date and Time of your Lost Visit Collaborations ecpi Grades Due Jun 3 by 11:59pm Points 100 Submitting a file upload UNIVERSITY Modules Your assignment is designed to reinforce the unit-learning objective L05: E05.1-5.2. LO5. Manage State Information and Security E05.1 Save state information with query strings, hidden form fields, and cookies. E05.2 Employ coding practices designed to address JavaScript security issues. Account Discussions ECPI Resources Office 365 ECPI Surveys Assignments Dashboard Instructions Quizzes You may write this program in one .html document, and you do not have to use any prior programs code. Write a web page that uses cookies to store the date and time of your last visit. Courses var now = new Date(); var day = now.getDay(): var date = now.getDate();, and so forth. Calendar Note: You do not have to open a prior exercise to complete this. When you open your form for the first time, it should resemble this: Inbox D e Ausenbellet DesktopLastVisitTest.html - Last Vise Help This is your first visit If you refresh the form once, it should resemble this: CUzerz'urbanlietDesktop Last VisitTest.html - e Last Visit Your last visit was undefined Tuesday 10/31/2017 at 12:5:31 Continually refreshing will add dates and times to the outputExplanation / Answer
<!DOCTYPE html>
<html>
<head>
<script>
function setCookie(cname,cvalue,exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires=" + d.toGMTString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
function getCookie(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
function checkCookie() {
var nowdate=getCookie("date");
if (nowdate != "") {
var res= nowdate.split(" ")
x=new Date(nowdate);
document.write("your last visit was " ,res[0]," ", x.getDay()+"/"+x.getMonth(),"/"+x.getFullYear()," at ",res[4]);
} else {
document.write("this is your first visit");
var nowdate = new Date()
if (nowdate != "" && nowdate != null) {
setCookie("date", nowdate, 30);
}
}
}
</script>
</head>
<body>
</body>
</html>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.