Presentation is loading. Please wait.

Presentation is loading. Please wait.

HTML Darby Tien-Hao Chang Department of Electrical Engineering National Cheng Kung University.

Similar presentations


Presentation on theme: "HTML Darby Tien-Hao Chang Department of Electrical Engineering National Cheng Kung University."— Presentation transcript:

1 HTML Darby Tien-Hao Chang Department of Electrical Engineering National Cheng Kung University

2 HTML introduction HTML stands for Hyper Text Markup Language An HTML file is a text file containing small markup tags The markup tags tell the Web browser how to display the page An HTML file must have an htm or html file extension An HTML file can be created using a simple text editor

3 Sample HTML Title of page This is my first homepage. This text is bold

4 HTML elements HTML tags are used to mark-up HTML elements HTML tags are surrounded by the two characters The surrounding characters are called angle brackets HTML tags normally come in pairs like and The first tag in a pair is the start tag, the second tag is the end tag The text between the start and end tags is the element content HTML tags are not case sensitive, means the same as

5 Sample HTML This text is bold Start tag content end tag This is my first homepage. This text is bold Tag attribute

6 Basic HTML tags Defines an HTML document Defines the document's body to Defines header 1 to header 6 to Defines a paragraph Inserts a single line break Defines a horizontal rule Defines a comment

7 Sample HTML This is heading 1 This is heading 2 This is heading 3 This is heading 4 This is heading 5 This is heading 6

8 Sample HTML This paragraph contains a lot of lines in the source code, but the browser ignores it. To break lines in a paragraph, use the br tag.

9 Sample HTML This is heading 1 This is heading 2

10 More HTML tags Defines bold text Defines big text Defines emphasized text Defines italic text Defines small text Defines strong text Defines subscripted text Defines superscripted text Defines inserted text Defines deleted text Defines computer code text Defines keyboard text Defines sample computer code Defines teletype text Defines a variable Defines preformatted text Defines an abbreviation Defines an acronym Defines an address element Defines the text direction Defines a long quotation Defines a short quotation Defines a citation Defines a definition term

11 Haha s/ ]*>//g

12 Powerful regular expression s/ ]*>//g s substitute < left angle bracket [^>] any character except right angle bracket [^>]* all characters formed the tag (attributes) > right angle bracket g replace globally, i.e. all occurrences

13 Is semantic important? Yes, sometimes  To extract the heading of a news article  http://news.yam.com/ettoday/society/200608/2006 0816189987.html  發票案/李慧芬週五前 返澳 近日將與李碧君對質  /^ (.*) \n$/  print $1, “\n”;

14 How to display a less than sign (<) in browser? Character Entities  A character entity has three parts: an ampersand (&), an entity name or a # and an entity number, and finally a semicolon (;).  To display a less than sign in an HTML document we must write: < or <

15 The most common character entities ResultDescriptionEntity nameEntity number non-breaking space   <less than<< >greater than>> &ampersand&& "quotation mark"" 'apostrophe&apos;'

16 HTML links This text is a link to a page on this Web site. This text is a link to a page on the World Wide Web.

17 HTML frames

18 HTML frames

19 HTML tables row 1, cell 1 row 1, cell 2 row 2, cell 1 row 2, cell 2

20 HTML tables Cell that spans two columns: Name Telephone Bill Gates 555 77 854 555 77 855 Cell that spans two rows: First Name: Bill Gates Telephone: 555 77 854 555 77 855

21 HTML lists An Unordered List: Coffee Tea An Ordered List: Coffee Tea A Definition List: Coffee Black hot drink Milk White cold drink

22 HTML forms  description: description  description 1  description 2 default text

23 Form ’ s action attribute and submit button  Username: 

24 Methods GET and POST in HTML forms - what's the difference? http://www.cs.tut.fi/~jkorpela/forms/methods.html The difference between GET and POST is primarily defined in terms of form data encoding so that former means that form data is to be encoded (by a browser) into a URL while the latter means that the form data is to appear within a message body If the processing of a form is idempotent (i.e. it has no lasting observable effect on the state of the world), then the form method should be GET If the service associated with the processing of a form has side effects (for example, modification of a database or subscription to a service), the method should be POST

25 Exercise Resolution, number of units, EC no. and so on with a given PDB ID  http://www.pdb.org/ http://www.pdb.org/ Today’s headings Comics  http://jojo.jojohot.com/ http://jojo.jojohot.com/ use LWP::Simple; $web = &get( $url );

26 Exercise hints $web =~ /Title\s* \s*[^>]*>\s*([^\n]+)/

27 Javascript – a case study http://proteminer.csie.ntu.edu.tw/

28 A review of dirtycomi http://dm.www.wangyou.com/ Encoding (Big5, GB2312, UTF-8) Retrieve HTML code with GET method Traverse multiple pages Trace Javascript code and re-implement it in Perl Completely pretend itself as a human + browser


Download ppt "HTML Darby Tien-Hao Chang Department of Electrical Engineering National Cheng Kung University."

Similar presentations


Ads by Google