diff --git a/lesson07/basicPrototype.html b/lesson07/basicPrototype.html new file mode 100644 index 0000000..5fb5ee4 --- /dev/null +++ b/lesson07/basicPrototype.html @@ -0,0 +1,31 @@ + + + + + String Object + + + +

CIW JavaScript Specialist

+

String Object

+ + + \ No newline at end of file diff --git a/lesson07/basicStringObject.html b/lesson07/basicStringObject.html new file mode 100644 index 0000000..0526f2c --- /dev/null +++ b/lesson07/basicStringObject.html @@ -0,0 +1,38 @@ + + + + + String Object + + + +

CIW JavaScript Specialist

+

String Object

+ + + \ No newline at end of file diff --git a/lesson07/example3a-pgc.html b/lesson07/example3a-pgc.html new file mode 100644 index 0000000..3ee08fa --- /dev/null +++ b/lesson07/example3a-pgc.html @@ -0,0 +1,54 @@ + + + + + Arrays + + +

CIW JavaScript Specialist

+

Arrays

+ + + \ No newline at end of file diff --git a/lesson07/example3b-pgc.html b/lesson07/example3b-pgc.html new file mode 100644 index 0000000..67b9efb --- /dev/null +++ b/lesson07/example3b-pgc.html @@ -0,0 +1,19 @@ + + + + + Array map() Method + + +

CIW JavaScript Specialist

+

Array map() Method

+ + + \ No newline at end of file diff --git a/lesson07/example4-pgc.html b/lesson07/example4-pgc.html new file mode 100644 index 0000000..e9e0322 --- /dev/null +++ b/lesson07/example4-pgc.html @@ -0,0 +1,37 @@ + + + + + Date Object + + +

CIW JavaScript Specialist

+

Date Object

+ + + \ No newline at end of file diff --git a/lesson07/example5-pgc.html b/lesson07/example5-pgc.html new file mode 100644 index 0000000..5cff053 --- /dev/null +++ b/lesson07/example5-pgc.html @@ -0,0 +1,25 @@ + + + + + Timer + + + +

CIW JavaScript Specialist

+

Timer

+
+ +
+ + \ No newline at end of file diff --git a/lesson08/ToyCustomObject.html b/lesson08/ToyCustomObject.html new file mode 100644 index 0000000..be5c42d --- /dev/null +++ b/lesson08/ToyCustomObject.html @@ -0,0 +1,24 @@ + + + + + Toy Custom Object + + + +

CIW JavaScript Specialist

+

Toy Custom Object

+ + + \ No newline at end of file diff --git a/lesson08/animals.html b/lesson08/animals.html new file mode 100644 index 0000000..1c9b281 --- /dev/null +++ b/lesson08/animals.html @@ -0,0 +1,22 @@ + + + + + JavaScript ES6 Classes + + + + +

CIW JavaScript Specialist

+

JavaScript ES6 Classes

+ + + + + + \ No newline at end of file diff --git a/lesson08/animals.js b/lesson08/animals.js new file mode 100644 index 0000000..343948b --- /dev/null +++ b/lesson08/animals.js @@ -0,0 +1,44 @@ +class Animal { + constructor(name) { + // Property + this.name = name; + } + // Methods + speak() { + return (this.name + ' makes a noise.'); + } + toString() { + return (this.name + ' is an animal. ' + this.speak()); + } +} +// Subclass +class Cat extends Animal { + speak() { + return (this.name + ' meows.'); + } + toString() { + return (this.name + ' is a cat. ' + this.speak()); + } +} +// Subclass +class Dog extends Animal { + speak() { + return (this.name + ' barks.'); + } + toString() { + return (this.name + ' is a dog. ' + this.speak()) + } +} +// Subclass +class Goat extends Animal { + constructor(name, age) { + super(name); + this.age = age; + } + speak() { + return (this.name + ' bleats.'); + } + toString() { + return (this.name + ' is a goat. ' + this.speak() + ' ' + this.name + ' is ' + this.age + ' years old.'); + } +} \ No newline at end of file diff --git a/lesson08/book.js b/lesson08/book.js new file mode 100644 index 0000000..d096970 --- /dev/null +++ b/lesson08/book.js @@ -0,0 +1,21 @@ +//Define book constructor pass three parameter +function Book(theTitle,theAuthor,thePrice) { + //assign parameter to properties of custom object + this.title = theTitle; + this.author = theAuthor; + this.price = thePrice; + //define method call show, which call function showProps + this.show = showProps; +}; + +function showProps() { + var result = ''; + //for i in this statement, display all the properties + for (var i in this) { + //however it will not display when(i is 'show' which is book object, or i is 'addTax' ) + if (i == 'show' || i == 'addTax') continue; + //assign result : property name = value of property, and increment + result += i + '=' + this[i] + '
'; + } + return result; +}; \ No newline at end of file diff --git a/lesson08/dropDownArray.html b/lesson08/dropDownArray.html new file mode 100644 index 0000000..cb913e8 --- /dev/null +++ b/lesson08/dropDownArray.html @@ -0,0 +1,39 @@ + + + + + Employee Database + + + + +

CIW JavaScript Specialist

+

Employee Database

+
+ Select a name to view information: + + +

+
+ + \ No newline at end of file diff --git a/lesson08/employee.js b/lesson08/employee.js new file mode 100644 index 0000000..23e7167 --- /dev/null +++ b/lesson08/employee.js @@ -0,0 +1,22 @@ +function employeeObject(theName,theDepartment,theExtension) { + this.name = theName; + this.department = theDepartment; + this.extension = theExtension; + this.showEmployee = showEmployee; +}; +function showEmployee() { + var info = ''; + info += 'Employee: '+this.name+'\n'; + info += 'Department: '+this.department+'\n'; + info += 'Extension: '+this.extension+'\n'; + alert(info); +}; +function showAllEmployees() { + var info = ''; + for (var i=1;i + + + + Soldier Custom Object + + + +

CIW JavaScript Specialist

+

Soldier Custom Object

+ + + \ No newline at end of file diff --git a/lesson08/language.js b/lesson08/language.js new file mode 100644 index 0000000..32d3d20 --- /dev/null +++ b/lesson08/language.js @@ -0,0 +1,30 @@ +function WebLanguages(myName,myBestPart,myEaseToLearn,myRating) { + this.name = myName; + this.bestPart = myBestPart; + this.easeToLearn = myEaseToLearn; + this.rating = myRating; +}; +function show(languageShow) { + document.write('Language Name: '+languageShow.name+'
'); + document.write('Best Part: '+languageShow.bestPart+'
'); + document.write('Ease of Learning: '+languageShow.easeToLearn+ + '
'); + document.write('Rating 1 to 10: '+languageShow.rating+'
'); + document.write('
'); +}; + +var JS = new WebLanguages('JavaScript','Makes cool effects', + 'Moderate',10); +var JV = new WebLanguages('Java', + 'Makes platform-independent applications','Hard',8); +var HT = new WebLanguages('HTML5/CSS', + 'Makes pretty pages','Easy',9); + +function start() { + document.write('

JavaScript Specialist

'); + document.write('

Rating Web Languages

'); + //show object passing HT variable which contains webLangagues custom object. + show(HT); + show(JS); + show(JV); +}; \ No newline at end of file diff --git a/lesson08/multipleCustomObject.html b/lesson08/multipleCustomObject.html new file mode 100644 index 0000000..3d66e11 --- /dev/null +++ b/lesson08/multipleCustomObject.html @@ -0,0 +1,41 @@ + + + + + House Custom Object + + + +

CIW JavaScript Specialist

+

House Custom Object

+ + + \ No newline at end of file diff --git a/lesson08/ratingWebLanguages.html b/lesson08/ratingWebLanguages.html new file mode 100644 index 0000000..0c95727 --- /dev/null +++ b/lesson08/ratingWebLanguages.html @@ -0,0 +1,10 @@ + + + + + Web Languages Custom Object + + + + + \ No newline at end of file diff --git a/lesson08/usePrototype.html b/lesson08/usePrototype.html new file mode 100644 index 0000000..9b83dba --- /dev/null +++ b/lesson08/usePrototype.html @@ -0,0 +1,31 @@ + + + + + Book Custom Object + + + +

CIW JavaScript Specialist

+

Book Custom Object

+ + + \ No newline at end of file diff --git a/lesson09/AppendingContent.html b/lesson09/AppendingContent.html new file mode 100644 index 0000000..5ba453c --- /dev/null +++ b/lesson09/AppendingContent.html @@ -0,0 +1,47 @@ + + + + + Appending Content + + + +

CIW JavaScript Specialist

+

Appending Content

+ Question: How many little pigs had houses made of straw?
+
+

+

+

+

+

+

+
+ + \ No newline at end of file diff --git a/lesson09/AppendingScript.html b/lesson09/AppendingScript.html new file mode 100644 index 0000000..0e1f7ea --- /dev/null +++ b/lesson09/AppendingScript.html @@ -0,0 +1,20 @@ + + + + + Appending Content JavaScript + + + +

+ + + + diff --git a/lesson09/changeAttribute.html b/lesson09/changeAttribute.html new file mode 100644 index 0000000..a467e49 --- /dev/null +++ b/lesson09/changeAttribute.html @@ -0,0 +1,39 @@ + + + + + Change Attribute + + + +

CIW JavaScript Specialist

+

Change Attribute

+
+

What are the attributes of this div tag?

+
+ + + diff --git a/lesson09/getElemenById.html b/lesson09/getElemenById.html new file mode 100644 index 0000000..7b29af3 --- /dev/null +++ b/lesson09/getElemenById.html @@ -0,0 +1,37 @@ + + + + + Change URL + + + +

CIW JavaScript Specialist

+

Change URL

+ Microsoft
+ + + \ No newline at end of file diff --git a/lesson09/getElementByClassName.html b/lesson09/getElementByClassName.html new file mode 100644 index 0000000..68e9f45 --- /dev/null +++ b/lesson09/getElementByClassName.html @@ -0,0 +1,24 @@ + + + + + Check CSS class data + + + +

CIW JavaScript Specialist

+

Check CSS class data

+

First

+

Second

+

Third

+ + + \ No newline at end of file diff --git a/lesson09/getElementByName.html b/lesson09/getElementByName.html new file mode 100644 index 0000000..28a2eb5 --- /dev/null +++ b/lesson09/getElementByName.html @@ -0,0 +1,27 @@ + + + + + Check named element data + + + +

CIW JavaScript Specialist

+

Check named element data

+
+
+
+ + + + \ No newline at end of file diff --git a/lesson09/getElementByTagName.html b/lesson09/getElementByTagName.html new file mode 100644 index 0000000..a6623d3 --- /dev/null +++ b/lesson09/getElementByTagName.html @@ -0,0 +1,60 @@ + + + + + Cool slide show + + + + +

CIW JavaScript Specialist

+

Cool slide show

+ First picture + Second picture + Third picture + Fourth picture + Fifth picture +

Click the image to advance the slides.

+ + \ No newline at end of file diff --git a/lesson09/hello.js b/lesson09/hello.js new file mode 100644 index 0000000..1a11e81 --- /dev/null +++ b/lesson09/hello.js @@ -0,0 +1 @@ +alert('Helloooo!'); \ No newline at end of file diff --git a/lesson09/images/pic1.jpg b/lesson09/images/pic1.jpg new file mode 100644 index 0000000..9981116 Binary files /dev/null and b/lesson09/images/pic1.jpg differ diff --git a/lesson09/images/pic2.jpg b/lesson09/images/pic2.jpg new file mode 100644 index 0000000..2f5a01e Binary files /dev/null and b/lesson09/images/pic2.jpg differ diff --git a/lesson09/images/pic3.jpg b/lesson09/images/pic3.jpg new file mode 100644 index 0000000..fe236c8 Binary files /dev/null and b/lesson09/images/pic3.jpg differ diff --git a/lesson09/images/pic4.jpg b/lesson09/images/pic4.jpg new file mode 100644 index 0000000..d9ca5ae Binary files /dev/null and b/lesson09/images/pic4.jpg differ diff --git a/lesson09/images/pic5.jpg b/lesson09/images/pic5.jpg new file mode 100644 index 0000000..8763797 Binary files /dev/null and b/lesson09/images/pic5.jpg differ 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