SlideShare a Scribd company logo
!
網⾴頁程式設計
Web Design
2014應⽤用輔具系統暑期課程
蕭傳錡、蕭兆原
1
OUTLINE
!
!
• HTML!
• CSS!
• Javascript!
• Develop Environment
Facebook
A Social Website
3
HTML
4
HTML
• HyperText Markup Languages!
• HyperText(超⽂文字):!
• Contains images, videos, links to other
documents!
• Markup Languages(標⽰示語⾔言):!
• Defines how to mark things
5
HTML
• A pure text file!
• Divided in two types:!
1. tag:to mark something up!
2. text:words seen in website!
• EX:<b>在’b’內的⽂文字會變粗體字</b>
• b: tag
6
Tag(markup)
• General!
• <b><i>bold & italic</i></b>
• <b><i>ERROR</b></i>
• Link tag!
• <a href=“http://xxxxxx/”>超連結名稱</a>!
• href is an attribute of <a>
7
Attribute(屬性)
!
• Consider tag as a type!
• Phone and camera are two types of things.!
• Attribute is like specification.!
• Two phones could have different resolutions. !
• One tag has various attributes.!
• <a target=“_blank" title="hello">
8
Example
<html>
<head>
<title>有背景圖的網⾴頁</title>
</head>
<body background=“image_path”>
加⼊入了背景圖!
</body>
</html>
9
Head/Body
• In General, we divide website into head,
body.!
• Head : Mostly, it contains web’s information
that can’t be seen in website. (title,language)
• Body : We usually put web’s content here.!
• <div id=“header”> : On the top of the
website!
• logo, login, manu bar!
• <div id=“wrapper”> : content!
• <div id=“footer”> : All Rights Reserved.
10
URL
• Uniform Resource Locators(資源定位器)!
• http://merry.ee.ncku.edu.tw/~legendd/final/(index.html)!
• index.htm or index.html !
• Protocol : http://、ftp://、telnet://、https://…!
• Machine : merry.ee.ncku.tw、140.116.165.74!
• File path : /~legend/index.html 、/login.php
11
Don’t memorize them.
(You’ll memorize some when time goes by)
12
Keep in mind
• HTML is plaintext containing real content and
corresponding tags and attributes.!
• You can create it in any text editor!
• Ex: Notepad++、Sublime Text、vim…!
• To develop a website ,it’s not programming but designing.!
• You must know tags and attributes which are in need.!
• Check query
13
CSS
CSS
!
• Cascading Style Sheet(串接/階層
樣式表)!
• Sheet!
• list!
• Style!
• how to design elements!
• Cascading!
• CSS selector!
• Can inherit style from its parent
15
HTML in website
What can css
do?16
17
Css can do…
• Almost everything. !
• background color, border, font, margin……!
• All you need to do is to arrange elements in the
right place.!
• The importance of web design.
18
Don’t memorize them.(again)
(You’ll memorize some when time goes by)(again)
19
Css selector
Important!
20
Keep in mind
• To connect HTML & CSS:!
• Add <link href=“demo.css” rel=“stylesheet” /> !
• CSS enriches HTML’s life!
• Make good use of MDN_CSS & css-tutorial!
• CSS3?!
• The Most Important CSS3 Properties Explained!
• A world About CSS4
21
Javascript
Activate your web
23
Javascript
• Have nothing to do with JAVA!!
• script language!
• Executed by browser!
• No internet connection is required!
• About its history!
• Code Rush: Netscape Mozilla紀錄⽚片 1998-2000!
• 網路演進!
• List of languages that compile to JS
24
DOM
• Document Object Model!
• DOM、About DOM!
• An interface for HTML/XML documents.!
• Browser will build DOM tree, which can be thought of
as a data structure to display html.!
• Also convenient for javascript to operate!
• Object the docs >> easy for programmers to understand
25
Method of JS(DOM)
• document.getelementById(‘foo’).value=‘bar’!
• document is an object of DOM!
• getelementById is a method, return a DOM object!
• value is an attribute of an input object!
• #foo is an input id!
• references
26
Method of JS(function)
function getElementsByClass( searchClass,
domNode, tagName) { !
! if (domNode == null) domNode =
document;!
! if (tagName == null) tagName = '*';!
! var el = new Array();!
! var tags =
domNode.getElementsByTagName(tagName);!
! var tcl = " "+searchClass+" ";!
! for(i=0,j=0; i<tags.length; i++) { !
! ! var test = " " + tags[i].className + " ";!
! ! if (test.indexOf(tcl) != -1) !
! ! ! el[j++] = tags[i];!
! } !
getElementByClass
27
28
jQuery!
A better and smarter way to use javascript
29
jQuery
• A javascript library (module)!
• because everyone use it, it became a library!
• Cross-platform!
• Easy to use and understand it!
• jQuery(‘.foo’).val(‘bar’);!
• jQuery API
30
More powerful
• More advanced functions and animations!
• jQuery(‘.foo’).animate({!
! ! ! ! ‘margin-left’:’100px’,!
! ! ! }, 2000, function(){!
! ! ! ! //animation completed!
! ! ! });
31
Event
• Event-driven programming!
• EX: click a button cause web transitions !
• jQuery(‘#foo’).click.(function(){…..});!
• consider <#foo> as a button!
• click is an event (click_API)!
• function(){…} is an anonymous function that will be
used very often in web programming.
32
References
• JavaScript Garden!
• Learn jQuery and JavsScript for free!
• 那些 Functional Programming 教我的事!
• anonymous function, closure, callback function!
• widely used
33
Make your website dynamic!
34
In Our Case
• What effect do you want?!
• waterfall-Masonry!
• fancyBox!
• Downloading jQuery packages and knowing how to
modify the parameters will be OK
35
HTML5
• Generally, it contains HTML, CSS, JavaScript!
• Specifically, HTML5 adds many new syntactic features, including <video>,
<audio>,<canvas>…!
• friendly in media and image!
• (JS+Canvas)《》(FLASH) war!
• Noticed that animations are build by JS and CSS but HTML5.!
• delete some elements(Use CSS instead.)!
• Besides DOM interface, it has more APIs!
• Canvas API, History management……
37
AJAX
• Asynchronous JavaScript and XML!
• XML (eXtensible): Can customize tags. Mostly used in transferring
data between web/docs!
• Ajax just updates a little part of web!
• Microsoft first proposed this innovation(from existing technologies)!
• Gmail made it real and popular. (history of gmail)!
• Advantage : speed(maintain data without updating the whole web)!
• Disadvantage : Previous page?!
• Solution : iframe(內嵌網⾴頁) or CSS+JS skills
Web Example
GoHome!
From Social Web Design Course
39
Environment
Linux、Windows、OSX
40
Windows/OSX
• Download PieTTY and login!
• Use SSH(Secure Shell) , like BBS client!
• A remote desktop of Linux(Server)!
• Make a directory(folder) to store your website!
• $ mkdir legend /* create a directory */!
• $ cd legend/ /* entering to this dir. */!
• Starting to write a HTML file!
• $ vi index.html /* create a file named <index.html> */!
• You can also use Filezilla to connect to FTP/Server.
41
Linux/OSX
• Linux:Get used to it !!
• OSX : Some useful commands!
• Connect to server by ssh!
• $ ssh legendd@merry.ee.ncku.tw !
• download file from remote server to local
computer(keyword : ssh remote)!
• $ scp -r legendd@merry.ee.ncku.edu.tw:/home/swd/
legendd/public_html/OAuth2/ /Users/legendshiao/Desktop/
42
43
Keep in mind
• Connect to CSS file:!
• <link href="index.css" rel="stylesheet" />!
• make sure <index.css> file is in the same directory!
• Connect to JavaScript file!
• <script type="text/javascript" src=“…”></script>!
• Importance of references
44
Thanks for listening!

More Related Content

What's hot

Haml And Sass In 15 Minutes
Haml And Sass In 15 MinutesHaml And Sass In 15 Minutes
Haml And Sass In 15 Minutes
Patrick Crowley
 
HTML/CSS Workshop @ Searchcamp
HTML/CSS Workshop @ SearchcampHTML/CSS Workshop @ Searchcamp
HTML/CSS Workshop @ Searchcamp
James Mills
 
Thinkful - Frontend Crash Course - Intro to HTML/CSS
Thinkful - Frontend Crash Course - Intro to HTML/CSSThinkful - Frontend Crash Course - Intro to HTML/CSS
Thinkful - Frontend Crash Course - Intro to HTML/CSS
TJ Stalcup
 
Sass: The Future of Stylesheets
Sass: The Future of StylesheetsSass: The Future of Stylesheets
Sass: The Future of Stylesheets
chriseppstein
 
Intro to OOCSS Workshop
Intro to OOCSS WorkshopIntro to OOCSS Workshop
Intro to OOCSS Workshop
Julie Cameron
 
How to Build a Bespoke Page Builder in WordPress
How to Build a Bespoke Page Builder in WordPressHow to Build a Bespoke Page Builder in WordPress
How to Build a Bespoke Page Builder in WordPress
Gerald Glynn
 
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Deepak Sharma
 
Webmonkey
WebmonkeyWebmonkey
Webmonkey
isac Lagerblad
 
Rapid and Responsive - UX to Prototype with Bootstrap
Rapid and Responsive - UX to Prototype with BootstrapRapid and Responsive - UX to Prototype with Bootstrap
Rapid and Responsive - UX to Prototype with Bootstrap
Josh Jeffryes
 
JSLink for ITPros - SharePoint Saturday Jersey
JSLink for ITPros - SharePoint Saturday JerseyJSLink for ITPros - SharePoint Saturday Jersey
JSLink for ITPros - SharePoint Saturday Jersey
Paul Hunt
 
What's Object-Oriented CSS (japanese)
What's Object-Oriented CSS (japanese)What's Object-Oriented CSS (japanese)
What's Object-Oriented CSS (japanese)
shinobu tsutsui
 
Web 102 INtro to CSS
Web 102  INtro to CSSWeb 102  INtro to CSS
Web 102 INtro to CSS
Hawkman Academy
 
Developing Your Ultimate Package
Developing Your Ultimate PackageDeveloping Your Ultimate Package
Developing Your Ultimate Package
Simon Collison
 
Oooh shiny
Oooh shinyOooh shiny
Oooh shiny
wcto2017
 
Design for Developers: Introduction to Bootstrap 3
Design for Developers: Introduction to Bootstrap 3Design for Developers: Introduction to Bootstrap 3
Design for Developers: Introduction to Bootstrap 3
John Bertucci
 
Html5 Brown Bag
Html5 Brown BagHtml5 Brown Bag
Html5 Brown Bag
stuplum
 
ActiveDOM
ActiveDOMActiveDOM
Jquery News Packages
Jquery News PackagesJquery News Packages
CSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreCSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and more
Russ Weakley
 
HTML5, just another presentation :)
HTML5, just another presentation :)HTML5, just another presentation :)
HTML5, just another presentation :)
François Massart
 

What's hot (20)

Haml And Sass In 15 Minutes
Haml And Sass In 15 MinutesHaml And Sass In 15 Minutes
Haml And Sass In 15 Minutes
 
HTML/CSS Workshop @ Searchcamp
HTML/CSS Workshop @ SearchcampHTML/CSS Workshop @ Searchcamp
HTML/CSS Workshop @ Searchcamp
 
Thinkful - Frontend Crash Course - Intro to HTML/CSS
Thinkful - Frontend Crash Course - Intro to HTML/CSSThinkful - Frontend Crash Course - Intro to HTML/CSS
Thinkful - Frontend Crash Course - Intro to HTML/CSS
 
Sass: The Future of Stylesheets
Sass: The Future of StylesheetsSass: The Future of Stylesheets
Sass: The Future of Stylesheets
 
Intro to OOCSS Workshop
Intro to OOCSS WorkshopIntro to OOCSS Workshop
Intro to OOCSS Workshop
 
How to Build a Bespoke Page Builder in WordPress
How to Build a Bespoke Page Builder in WordPressHow to Build a Bespoke Page Builder in WordPress
How to Build a Bespoke Page Builder in WordPress
 
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
 
Webmonkey
WebmonkeyWebmonkey
Webmonkey
 
Rapid and Responsive - UX to Prototype with Bootstrap
Rapid and Responsive - UX to Prototype with BootstrapRapid and Responsive - UX to Prototype with Bootstrap
Rapid and Responsive - UX to Prototype with Bootstrap
 
JSLink for ITPros - SharePoint Saturday Jersey
JSLink for ITPros - SharePoint Saturday JerseyJSLink for ITPros - SharePoint Saturday Jersey
JSLink for ITPros - SharePoint Saturday Jersey
 
What's Object-Oriented CSS (japanese)
What's Object-Oriented CSS (japanese)What's Object-Oriented CSS (japanese)
What's Object-Oriented CSS (japanese)
 
Web 102 INtro to CSS
Web 102  INtro to CSSWeb 102  INtro to CSS
Web 102 INtro to CSS
 
Developing Your Ultimate Package
Developing Your Ultimate PackageDeveloping Your Ultimate Package
Developing Your Ultimate Package
 
Oooh shiny
Oooh shinyOooh shiny
Oooh shiny
 
Design for Developers: Introduction to Bootstrap 3
Design for Developers: Introduction to Bootstrap 3Design for Developers: Introduction to Bootstrap 3
Design for Developers: Introduction to Bootstrap 3
 
Html5 Brown Bag
Html5 Brown BagHtml5 Brown Bag
Html5 Brown Bag
 
ActiveDOM
ActiveDOMActiveDOM
ActiveDOM
 
Jquery News Packages
Jquery News PackagesJquery News Packages
Jquery News Packages
 
CSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreCSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and more
 
HTML5, just another presentation :)
HTML5, just another presentation :)HTML5, just another presentation :)
HTML5, just another presentation :)
 

Similar to 網頁程式設計

How to start developing apps for Firefox OS
How to start developing apps for Firefox OSHow to start developing apps for Firefox OS
How to start developing apps for Firefox OS
benko
 
About Best friends - HTML, CSS and JS
About Best friends - HTML, CSS and JSAbout Best friends - HTML, CSS and JS
About Best friends - HTML, CSS and JS
Naga Harish M
 
Untangling the web - fall2017 - class 4
Untangling the web - fall2017 - class 4Untangling the web - fall2017 - class 4
Untangling the web - fall2017 - class 4
Derek Jacoby
 
The web context
The web contextThe web context
The web context
Dan Phiffer
 
HTML5: Introduction
HTML5: IntroductionHTML5: Introduction
HTML5: Introduction
Guillermo Paz
 
On Web Browsers
On Web BrowsersOn Web Browsers
On Web Browsers
Hajime Morrita
 
Front-End Frameworks: a quick overview
Front-End Frameworks: a quick overviewFront-End Frameworks: a quick overview
Front-End Frameworks: a quick overview
Diacode
 
The things we found in your website
The things we found in your websiteThe things we found in your website
The things we found in your website
hernanibf
 
Masterin Large Scale Java Script Applications
Masterin Large Scale Java Script ApplicationsMasterin Large Scale Java Script Applications
Masterin Large Scale Java Script Applications
Fabian Jakobs
 
7 web design
7 web design7 web design
7 web design
pranitag1
 
Solving Common Client Requets with jQuery Presentation (v2)
Solving Common Client Requets with jQuery Presentation (v2)Solving Common Client Requets with jQuery Presentation (v2)
Solving Common Client Requets with jQuery Presentation (v2)
Chris Coyier
 
Fast Web Applications with Go
Fast Web Applications with Go Fast Web Applications with Go
Fast Web Applications with Go
Eylem Ozekin
 
Intro to HTML 5 / CSS 3
Intro to HTML 5 / CSS 3Intro to HTML 5 / CSS 3
Intro to HTML 5 / CSS 3
Tadpole Collective
 
Web design-workflow
Web design-workflowWeb design-workflow
Web design-workflow
Peter Kaizer
 
Html
HtmlHtml
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
SPTechCon
 
Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]
Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]
Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]
David Wesst
 
HTML5 for ASP.NET Developers
HTML5 for ASP.NET DevelopersHTML5 for ASP.NET Developers
HTML5 for ASP.NET Developers
Justin Lee
 
Oxford DrupalCamp 2012 - The things we found in your website
Oxford DrupalCamp 2012 - The things we found in your websiteOxford DrupalCamp 2012 - The things we found in your website
Oxford DrupalCamp 2012 - The things we found in your website
hernanibf
 
October 2014 - USG Rock Eagle - Sass 101
October 2014 - USG Rock Eagle - Sass 101October 2014 - USG Rock Eagle - Sass 101
October 2014 - USG Rock Eagle - Sass 101
Eric Sembrat
 

Similar to 網頁程式設計 (20)

How to start developing apps for Firefox OS
How to start developing apps for Firefox OSHow to start developing apps for Firefox OS
How to start developing apps for Firefox OS
 
About Best friends - HTML, CSS and JS
About Best friends - HTML, CSS and JSAbout Best friends - HTML, CSS and JS
About Best friends - HTML, CSS and JS
 
Untangling the web - fall2017 - class 4
Untangling the web - fall2017 - class 4Untangling the web - fall2017 - class 4
Untangling the web - fall2017 - class 4
 
The web context
The web contextThe web context
The web context
 
HTML5: Introduction
HTML5: IntroductionHTML5: Introduction
HTML5: Introduction
 
On Web Browsers
On Web BrowsersOn Web Browsers
On Web Browsers
 
Front-End Frameworks: a quick overview
Front-End Frameworks: a quick overviewFront-End Frameworks: a quick overview
Front-End Frameworks: a quick overview
 
The things we found in your website
The things we found in your websiteThe things we found in your website
The things we found in your website
 
Masterin Large Scale Java Script Applications
Masterin Large Scale Java Script ApplicationsMasterin Large Scale Java Script Applications
Masterin Large Scale Java Script Applications
 
7 web design
7 web design7 web design
7 web design
 
Solving Common Client Requets with jQuery Presentation (v2)
Solving Common Client Requets with jQuery Presentation (v2)Solving Common Client Requets with jQuery Presentation (v2)
Solving Common Client Requets with jQuery Presentation (v2)
 
Fast Web Applications with Go
Fast Web Applications with Go Fast Web Applications with Go
Fast Web Applications with Go
 
Intro to HTML 5 / CSS 3
Intro to HTML 5 / CSS 3Intro to HTML 5 / CSS 3
Intro to HTML 5 / CSS 3
 
Web design-workflow
Web design-workflowWeb design-workflow
Web design-workflow
 
Html
HtmlHtml
Html
 
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
 
Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]
Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]
Rich and Beautiful: Making Attractive Apps in HTML5 [Wpg 2013]
 
HTML5 for ASP.NET Developers
HTML5 for ASP.NET DevelopersHTML5 for ASP.NET Developers
HTML5 for ASP.NET Developers
 
Oxford DrupalCamp 2012 - The things we found in your website
Oxford DrupalCamp 2012 - The things we found in your websiteOxford DrupalCamp 2012 - The things we found in your website
Oxford DrupalCamp 2012 - The things we found in your website
 
October 2014 - USG Rock Eagle - Sass 101
October 2014 - USG Rock Eagle - Sass 101October 2014 - USG Rock Eagle - Sass 101
October 2014 - USG Rock Eagle - Sass 101
 

網頁程式設計

  • 2. OUTLINE ! ! • HTML! • CSS! • Javascript! • Develop Environment
  • 5. HTML • HyperText Markup Languages! • HyperText(超⽂文字):! • Contains images, videos, links to other documents! • Markup Languages(標⽰示語⾔言):! • Defines how to mark things 5
  • 6. HTML • A pure text file! • Divided in two types:! 1. tag:to mark something up! 2. text:words seen in website! • EX:<b>在’b’內的⽂文字會變粗體字</b> • b: tag 6
  • 7. Tag(markup) • General! • <b><i>bold & italic</i></b> • <b><i>ERROR</b></i> • Link tag! • <a href=“http://xxxxxx/”>超連結名稱</a>! • href is an attribute of <a> 7
  • 8. Attribute(屬性) ! • Consider tag as a type! • Phone and camera are two types of things.! • Attribute is like specification.! • Two phones could have different resolutions. ! • One tag has various attributes.! • <a target=“_blank" title="hello"> 8
  • 10. Head/Body • In General, we divide website into head, body.! • Head : Mostly, it contains web’s information that can’t be seen in website. (title,language) • Body : We usually put web’s content here.! • <div id=“header”> : On the top of the website! • logo, login, manu bar! • <div id=“wrapper”> : content! • <div id=“footer”> : All Rights Reserved. 10
  • 11. URL • Uniform Resource Locators(資源定位器)! • http://merry.ee.ncku.edu.tw/~legendd/final/(index.html)! • index.htm or index.html ! • Protocol : http://、ftp://、telnet://、https://…! • Machine : merry.ee.ncku.tw、140.116.165.74! • File path : /~legend/index.html 、/login.php 11
  • 12. Don’t memorize them. (You’ll memorize some when time goes by) 12
  • 13. Keep in mind • HTML is plaintext containing real content and corresponding tags and attributes.! • You can create it in any text editor! • Ex: Notepad++、Sublime Text、vim…! • To develop a website ,it’s not programming but designing.! • You must know tags and attributes which are in need.! • Check query 13
  • 14. CSS
  • 15. CSS ! • Cascading Style Sheet(串接/階層 樣式表)! • Sheet! • list! • Style! • how to design elements! • Cascading! • CSS selector! • Can inherit style from its parent 15
  • 16. HTML in website What can css do?16
  • 17. 17
  • 18. Css can do… • Almost everything. ! • background color, border, font, margin……! • All you need to do is to arrange elements in the right place.! • The importance of web design. 18
  • 19. Don’t memorize them.(again) (You’ll memorize some when time goes by)(again) 19
  • 21. Keep in mind • To connect HTML & CSS:! • Add <link href=“demo.css” rel=“stylesheet” /> ! • CSS enriches HTML’s life! • Make good use of MDN_CSS & css-tutorial! • CSS3?! • The Most Important CSS3 Properties Explained! • A world About CSS4 21
  • 24. Javascript • Have nothing to do with JAVA!! • script language! • Executed by browser! • No internet connection is required! • About its history! • Code Rush: Netscape Mozilla紀錄⽚片 1998-2000! • 網路演進! • List of languages that compile to JS 24
  • 25. DOM • Document Object Model! • DOM、About DOM! • An interface for HTML/XML documents.! • Browser will build DOM tree, which can be thought of as a data structure to display html.! • Also convenient for javascript to operate! • Object the docs >> easy for programmers to understand 25
  • 26. Method of JS(DOM) • document.getelementById(‘foo’).value=‘bar’! • document is an object of DOM! • getelementById is a method, return a DOM object! • value is an attribute of an input object! • #foo is an input id! • references 26
  • 27. Method of JS(function) function getElementsByClass( searchClass, domNode, tagName) { ! ! if (domNode == null) domNode = document;! ! if (tagName == null) tagName = '*';! ! var el = new Array();! ! var tags = domNode.getElementsByTagName(tagName);! ! var tcl = " "+searchClass+" ";! ! for(i=0,j=0; i<tags.length; i++) { ! ! ! var test = " " + tags[i].className + " ";! ! ! if (test.indexOf(tcl) != -1) ! ! ! ! el[j++] = tags[i];! ! } ! getElementByClass 27
  • 28. 28
  • 29. jQuery! A better and smarter way to use javascript 29
  • 30. jQuery • A javascript library (module)! • because everyone use it, it became a library! • Cross-platform! • Easy to use and understand it! • jQuery(‘.foo’).val(‘bar’);! • jQuery API 30
  • 31. More powerful • More advanced functions and animations! • jQuery(‘.foo’).animate({! ! ! ! ! ‘margin-left’:’100px’,! ! ! ! }, 2000, function(){! ! ! ! ! //animation completed! ! ! ! }); 31
  • 32. Event • Event-driven programming! • EX: click a button cause web transitions ! • jQuery(‘#foo’).click.(function(){…..});! • consider <#foo> as a button! • click is an event (click_API)! • function(){…} is an anonymous function that will be used very often in web programming. 32
  • 33. References • JavaScript Garden! • Learn jQuery and JavsScript for free! • 那些 Functional Programming 教我的事! • anonymous function, closure, callback function! • widely used 33
  • 34. Make your website dynamic! 34
  • 35. In Our Case • What effect do you want?! • waterfall-Masonry! • fancyBox! • Downloading jQuery packages and knowing how to modify the parameters will be OK 35
  • 36.
  • 37. HTML5 • Generally, it contains HTML, CSS, JavaScript! • Specifically, HTML5 adds many new syntactic features, including <video>, <audio>,<canvas>…! • friendly in media and image! • (JS+Canvas)《》(FLASH) war! • Noticed that animations are build by JS and CSS but HTML5.! • delete some elements(Use CSS instead.)! • Besides DOM interface, it has more APIs! • Canvas API, History management…… 37
  • 38. AJAX • Asynchronous JavaScript and XML! • XML (eXtensible): Can customize tags. Mostly used in transferring data between web/docs! • Ajax just updates a little part of web! • Microsoft first proposed this innovation(from existing technologies)! • Gmail made it real and popular. (history of gmail)! • Advantage : speed(maintain data without updating the whole web)! • Disadvantage : Previous page?! • Solution : iframe(內嵌網⾴頁) or CSS+JS skills
  • 39. Web Example GoHome! From Social Web Design Course 39
  • 41. Windows/OSX • Download PieTTY and login! • Use SSH(Secure Shell) , like BBS client! • A remote desktop of Linux(Server)! • Make a directory(folder) to store your website! • $ mkdir legend /* create a directory */! • $ cd legend/ /* entering to this dir. */! • Starting to write a HTML file! • $ vi index.html /* create a file named <index.html> */! • You can also use Filezilla to connect to FTP/Server. 41
  • 42. Linux/OSX • Linux:Get used to it !! • OSX : Some useful commands! • Connect to server by ssh! • $ ssh legendd@merry.ee.ncku.tw ! • download file from remote server to local computer(keyword : ssh remote)! • $ scp -r legendd@merry.ee.ncku.edu.tw:/home/swd/ legendd/public_html/OAuth2/ /Users/legendshiao/Desktop/ 42
  • 43. 43
  • 44. Keep in mind • Connect to CSS file:! • <link href="index.css" rel="stylesheet" />! • make sure <index.css> file is in the same directory! • Connect to JavaScript file! • <script type="text/javascript" src=“…”></script>! • Importance of references 44