introduction to internet engineering tutorial 7 all about assignment 2 by tse hok...

15
Introduction to Internet Engineering Tutorial 7 All about Assignment 2 By Tse Hok Man([email protected])

Upload: evelyn-floyd

Post on 11-Jan-2016

214 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Introduction to Internet Engineering Tutorial 7 All about Assignment 2 By Tse Hok Man(hmtse3@ie.cuhk.edu.hk)

Introduction to Internet Engineering

Tutorial 7All about Assignment 2

By Tse Hok Man([email protected])

Page 2: Introduction to Internet Engineering Tutorial 7 All about Assignment 2 By Tse Hok Man(hmtse3@ie.cuhk.edu.hk)

Requirement for all student

• Search engine

• Using JavaScript

• 5 different web pages, each contains the details of one product

• Each product should have at least 4 different fields

Page 3: Introduction to Internet Engineering Tutorial 7 All about Assignment 2 By Tse Hok Man(hmtse3@ie.cuhk.edu.hk)

For Bookstore

• Each book should have a– Book name (e.g. Harry Potter)– Author (e.g. J. K. Rowling)– Price – Reader’s review

Page 4: Introduction to Internet Engineering Tutorial 7 All about Assignment 2 By Tse Hok Man(hmtse3@ie.cuhk.edu.hk)

For mobile phone store

• Each mobile phone should have a– Model Number (e.g. P408)– Brand Name (e.g. Samsung)– Price– Phone’s details which may include dimension,

special functions and etc. (e.g. 90.5x47.5x23 mm)

Page 5: Introduction to Internet Engineering Tutorial 7 All about Assignment 2 By Tse Hok Man(hmtse3@ie.cuhk.edu.hk)

User Input

• Use form to accept user input• A ‘text’ for key word• A ‘select’ for key word type• A group of ‘radio’ for AND/OR• Two ‘select’ for price range• A ‘submit’ for search

Page 6: Introduction to Internet Engineering Tutorial 7 All about Assignment 2 By Tse Hok Man(hmtse3@ie.cuhk.edu.hk)

Details of key word type

• 3 types of key word– Key in Book name / Phone number– Key in Author / Brand name– Key in all fields

• For Bookstore– All fields include book name, author and

reader’s review

• For Mobile phone store– All fields include phone number, brand name

and phone’s details

Page 7: Introduction to Internet Engineering Tutorial 7 All about Assignment 2 By Tse Hok Man(hmtse3@ie.cuhk.edu.hk)

Details of price range

• For Bookstore– First select from $0 to $400– Second select from $100 to $500– Each selection should increased by $100

• For Mobile phone store– First select from $0 to $4000– Second select from $1000 to $5000– Each selection should increased by $1000

Page 8: Introduction to Internet Engineering Tutorial 7 All about Assignment 2 By Tse Hok Man(hmtse3@ie.cuhk.edu.hk)

Use of AND/OR

• Key word search and price search are combined using AND/OR

Key word search Key word search resultresult Price search resultPrice search result

ANDAND

Page 9: Introduction to Internet Engineering Tutorial 7 All about Assignment 2 By Tse Hok Man(hmtse3@ie.cuhk.edu.hk)

Use of AND/OR

• Be careful of duplicated search result

• Each product should be displayed only once in the search result

• Duplicated product will deduct marks

Page 10: Introduction to Internet Engineering Tutorial 7 All about Assignment 2 By Tse Hok Man(hmtse3@ie.cuhk.edu.hk)

Display of search result

• Search result should be displayed in a web page• Search result may be displayed in the sample

window or a new window• Use table to display each product• The table should contain the details of the product

(e.g. book name, author, price and reader’s review)• Each search result should contain a link which

directed to the web pages of the product

Page 11: Introduction to Internet Engineering Tutorial 7 All about Assignment 2 By Tse Hok Man(hmtse3@ie.cuhk.edu.hk)

Sample of search result

Page 12: Introduction to Internet Engineering Tutorial 7 All about Assignment 2 By Tse Hok Man(hmtse3@ie.cuhk.edu.hk)

Improvement

1. Use frame to implement the search engine (0.5 marks)

– The upper frame for the user input– The lower frame for displaying the search

result

2. Multiple key word search (1.5 marks)− Each word in the ‘text’ field should be

processed as individual word.− Combine the search result using OR

Page 13: Introduction to Internet Engineering Tutorial 7 All about Assignment 2 By Tse Hok Man(hmtse3@ie.cuhk.edu.hk)

How to match a word/string in another string?

• Use Regular expressions (RegExp)

• E.g.var key1 = ‘Snoopy’;

var key2 = ‘Mcmug’;

var data = ‘Hello Kitty and Snoopy’;

var reg1 = RegExp(key1);

var reg2 = RegExp(key2);

var result1 = data.match(reg1);

Var result2 = data.match(reg2);

Page 14: Introduction to Internet Engineering Tutorial 7 All about Assignment 2 By Tse Hok Man(hmtse3@ie.cuhk.edu.hk)

Suggestion in Implementation

• Use Array to store the data of each product.

• The Array should be a Global variable

• Only simple details of each product are required

• To implement multiple key word search, you may use split()

Page 15: Introduction to Internet Engineering Tutorial 7 All about Assignment 2 By Tse Hok Man(hmtse3@ie.cuhk.edu.hk)

Submission

• All student should submit their assignment on or before 23:59:59 on 4th Nov, 2003

• Put the web pages in your UNIX account• Zip all the files and name it with your login name• Send a email to tutor ([email protected]) with

title “Submission of Assignment 2” which contain your NAME, STUDENT ID, DEPARTMENT, EMAIL, THE WEB PAGE ADDRESS and the ZIP FILE.