diff --git a/lesson11/browserDetection.html b/lesson11/browserDetection.html new file mode 100644 index 0000000..a48ccab --- /dev/null +++ b/lesson11/browserDetection.html @@ -0,0 +1,58 @@ + + + + + Browser Detection + + + +

CIW JavaScript Specialist

+

Browser Detection

+ + + \ No newline at end of file diff --git a/lesson11/cookies.html b/lesson11/cookies.html new file mode 100644 index 0000000..0cdb5ee --- /dev/null +++ b/lesson11/cookies.html @@ -0,0 +1,35 @@ + + + + + Cookies + + + +

CIW JavaScript Specialist

+

Cookies

+ + + \ No newline at end of file diff --git a/lesson11/cookies.js b/lesson11/cookies.js new file mode 100644 index 0000000..b7404a3 --- /dev/null +++ b/lesson11/cookies.js @@ -0,0 +1,49 @@ +//cookie name is matched with input tag id +var cookieName = 'clientname'; + +var currentDate = new Date(); +function getNameCookie() { + var cookieReturn = ''; + var allCookies = document.cookie; + var cookieArray = allCookies.split(';'); //if there is multiple cookie, saperate by ; + for (var i = 0; i < cookieArray.length; i++) { + var theCookie = cookieArray[i]; + //if there is any space beteween cookie, remove that space + while (theCookie.charAt(0) == ' ') theCookie = theCookie.substring(1,theCookie.length); + if (theCookie.indexOf(cookieName + '=') == 0) { //if there is any equal sign, assign as 0 means starting + cookieReturn = theCookie.substring(cookieName.length + 1, theCookie.length); + } + } + return cookieReturn; +} +function setNameCookie() { + var expireDate = new Date(currentDate.getFullYear() + 1, currentDate.getMonth(), currentDate.getDate()); + var cookieValue = document.getElementById(cookieName).value; + var setCookie = cookieName + '=' + cookieValue; + setCookie += ';expires=' + expireDate.toUTCString(); + alert('Set to: ' + setCookie); + document.cookie = setCookie; +} + +function deleteNameCookie() { + var expireDate = new Date(currentDate.getFullYear() - 1, currentDate.getMonth(), currentDate.getDate()); + var setCookie = cookieName + '='; + setCookie += ';expires=' + expireDate.toUTCString(); + alert('Set to: ' + setCookie); + document.cookie = setCookie; +} + +function setAuthorCookie() { + var expireDate = new Date(currentDate.getFullYear()+1, currentDate.getMonth(), currentDate.getDate()); + var setCookie = 'Author=George Cooke'; + setCookie += ';expires=' + expireDate.toUTCString(); + alert('Set to: '+setCookie); + document.cookie = setCookie; +}; +function deleteAuthorCookie() { + var expireDate = new Date(currentDate.getFullYear()-1, currentDate.getMonth(), currentDate.getDate()); + var setCookie = 'Author='; + setCookie += ';expires=' + expireDate.toUTCString(); + alert('Delete: ' + setCookie); + document.cookie = setCookie; +}; \ No newline at end of file diff --git a/lesson11/encoding.html b/lesson11/encoding.html new file mode 100644 index 0000000..c32aec6 --- /dev/null +++ b/lesson11/encoding.html @@ -0,0 +1,22 @@ + + + + + Encoding Input/Output + + + +

CIW JavaScript Specialist

+

Encoding Input/Output

+
+ + + \ No newline at end of file diff --git a/lesson11/mimeTypes.html b/lesson11/mimeTypes.html new file mode 100644 index 0000000..82a616b --- /dev/null +++ b/lesson11/mimeTypes.html @@ -0,0 +1,40 @@ + + + + + Mime Types + + + +

CIW JavaScript Specialist

+

Mime Types

+ + + \ No newline at end of file diff --git a/lesson11/plugIns.html b/lesson11/plugIns.html new file mode 100644 index 0000000..10f5299 --- /dev/null +++ b/lesson11/plugIns.html @@ -0,0 +1,35 @@ + + + + + Plugins + + + +

CIW JavaScript Specialist

+

Plugins

+ + + \ No newline at end of file diff --git a/lesson11/poorJavascript.html b/lesson11/poorJavascript.html new file mode 100644 index 0000000..a6269ea --- /dev/null +++ b/lesson11/poorJavascript.html @@ -0,0 +1,19 @@ + + + + + Poorly written JavaScript + + + +

CIW JavaScript Specialist

+

Poorly written JavaScript

+
+ This page demonstrates poorly written code that + locks the browser. + + \ No newline at end of file diff --git a/lesson11/setDeleteCookie.html b/lesson11/setDeleteCookie.html new file mode 100644 index 0000000..f694447 --- /dev/null +++ b/lesson11/setDeleteCookie.html @@ -0,0 +1,27 @@ + + + + + Set/Delete Cookies + + + +

CIW JavaScript Specialist

+

Set/Delete Cookies

+
+ Name: + +
+ + + + + +
+ + \ No newline at end of file