1OverviewProgrmJavaScript

1OverviewProgrmJavaScript - Programming and JavaScript...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
(CS1301) Introduction to Computer Programming City Univ of HK / Dept of CS / Helena Wong 1. Overview of Programming and JavaScript - 1 http://www.cs.cityu.edu.hk/~helena Overview of  Programming and JavaScript Programming and JavaScript What is Computer Programming Brief History of JavaScript How to Include JavaScript in an HTML How to Display Message to Users How to Input Data from Users Numbers and Strings [Please switch off your phone]
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
(CS1301) Introduction to Computer Programming City Univ of HK / Dept of CS / Helena Wong 1. Overview of Programming and JavaScript - 2 http://www.cs.cityu.edu.hk/~helena " Human processing unit " What will you do when the phone rings? (1) event :a phone call (2) input : "Hi, I am Tom, I want to talk to you." (3) processing : Search your memory – remember him? Setup your answer: "Sorry, I don't know you." or "Hey …, long time no see." etc. . (4) output : say your answer The above is one of the many many programs in our brains . How about computer programs ?
Background image of page 2
(CS1301) Introduction to Computer Programming City Univ of HK / Dept of CS / Helena Wong 1. Overview of Programming and JavaScript - 3 http://www.cs.cityu.edu.hk/~helena In this course, we are to learn Computer program ming : Computer Programming is the  pro c e s s  o f  pla nning  a  s e q ue nc e  o f s te ps  fo r a  c o m pute r to  fo llo w . " How good a computer program is? " Is  it us e ful?   Is  it m a inta ina b le ?  Is  it e xte ns ib le ?  . . accurate? fast? cross-platform? What is a computer program? Computer A programmable device that can store, retrieve, and process data. Computer program A sequence of steps to be performed by a computer.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
(CS1301) Introduction to Computer Programming City Univ of HK / Dept of CS / Helena Wong 1. Overview of Programming and JavaScript - 4 http://www.cs.cityu.edu.hk/~helena Let’s glance a simple JavaScript program: Name: John Which color? Purple When the page is loaded, the user types a name and a text color. Then the page content is setup accordingly.
Background image of page 4
(CS1301) Introduction to Computer Programming City Univ of HK / Dept of CS / Helena Wong 1. Overview of Programming and JavaScript - 5 http://www.cs.cityu.edu.hk/~helena <HTML> <HEAD> <TITLE>De m o </TITLE> </HEAD> <BO DY> <S C RIPT LANG UAG E=ja va s c ript> …  prompt ('Nam e :', '') ; …  prompt ('Which color?', '') ; document.write (…) ; </SCRIPT> </BODY> </HTML> Explanation: The input dialogs are invoked by prompt . The document.write method outputs the content in the page. Each JavaScript statement is ended with a semi-colon: ; . Let’s glance a simple JavaScript program: Name: John Which color? Purple
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
(CS1301) Introduction to Computer Programming City Univ of HK / Dept of CS / Helena Wong 1. Overview of Programming and JavaScript - 6 http://www.cs.cityu.edu.hk/~helena What is JavaScript A language that allows you to write programs that are executed by a web-browser.
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/16/2011 for the course CS 1301 taught by Professor Dr.wong during the Winter '08 term at City University of Hong Kong.

Page1 / 29

1OverviewProgrmJavaScript - Programming and JavaScript...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online