CS105 Introduction to Computer Concepts

Slides:



Advertisements
Similar presentations
1 What is JavaScript? JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting language A scripting language is a lightweight.
Advertisements

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
1 COMM 1213 H1 COMP 4923 X1 JavaScript 1 (Readings: Ch. 10, 11 Knuckles)
The Web Warrior Guide to Web Design Technologies
HTML Forms JavaScript Introduction / Overview Lab Homework #1 CS 183 4/8/2010.
1 Outline 13.1Introduction 13.2A Simple Program: Printing a Line of Text in a Web Page 13.3Another JavaScript Program: Adding Integers 13.4Memory Concepts.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Introduction to Web Site Development Steven Emory Department of Computer Science California State University, Los Angeles Lecture 8: JavaScript I.
Web Page Behavior IS 373—Web Standards Todd Will.
CS 299 – Web Programming and Design Overview of JavaScript and DOM Instructor: Dr. Fang (Daisy) Tang.
2012 •••••••••••••••••••••••••••••••••• Summer WorkShop Mostafa Badr
Introduction to JavaScript. Aim To enable you to write you first JavaScript.
Introduction to scripting
آموزش طراحی وب سایت جلسه دهم – جاوا اسکریپت 1 تدریس طراحی وب برای اطلاعات بیشتر تماس بگیرید تاو شماره تماس: پست الکترونیک :
JavaScript CMPT 281. Outline Introduction to JavaScript Resources What is JavaScript? JavaScript in web pages.
WEB DESIGN AND PROGRAMMING Introduction to Javascript.
Week 9 PHP Cookies and Session Introduction to JavaScript.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
What is Java Script? An extension to HTML. An extension to HTML. Allows authors to incorporate some functionality in their web pages. (without using CGI.
Javascript. Outline Introduction Fundamental of JavaScript Javascript events management DOM and Dynamic HTML (DHTML)
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
Introduction to JavaScript Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan. 1.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Client-Side Scripting JavaScript.  produced by Netscape for use within HTML Web pages.  built into all the major modern browsers. properties  lightweight,
Dynamic Web Pages & JavaScript. Dynamic Web Pages Dynamic = Change Dynamic Web Pages are web pages that change. More than just moving graphics around.
JavaScript - A Web Script Language Fred Durao
Dr. Qusai Abuein1 Internet & WWW How to program Chap.(6) JavaScript:Introduction to Scripting.
1 JavaScript
JavaScript Programming Unit #1: Introduction. What is Programming?
JavaScript Scripting language What is Scripting ? A scripting language, script language, or extension language is a programming language.
Sahar Mosleh California State University San MarcosPage 1 JavaScript Basic.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming basics.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
 2000 Deitel & Associates, Inc. All rights reserved. Outline 8.1Introduction 8.2A Simple Program: Printing a Line of Text in a Web Page 8.3Another JavaScript.
By Tharith Sriv. To write a web page you use: HHTML (HyperText Markup Language), AASP (Active Server Page), PPHP (HyperText Preprocessor), JJavaScript,
JavaScript Introduction.  JavaScript is a scripting language  A scripting language is a lightweight programming language  A JavaScript can be inserted.
COMP403 Web Design JAVA SCRİPTS Tolgay KARANFİLLER.
4. Javascript M. Udin Harun Al Rasyid, S.Kom, Ph.D Lab Jaringan Komputer (C-307) Desain.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
HTML Overview Part 5 – JavaScript 1. Scripts 2  Scripts are used to add dynamic content to a web page.  Scripts consist of a list of commands that execute.
Pertemuan 5 IT133 Pengembangan Web JavaScript. What is JavaScript? JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting.
CIS 3.5 Lecture 2.3 "Introduction to JavaScript".
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Chapter 5: Intro to Scripting CIS 275—Web Application Development for Business I.
CNIT 133 Interactive Web Pags – JavaScript and AJAX Popup Boxes.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
© 2010 Robert K. Moniot1 Chapter 6 Introduction to JavaScript.
Module 1 Introduction to JavaScript
>> Introduction to JavaScript
Introduction to Client-Side Scripting and JavaScript
CHAPTER 10 JAVA SCRIPT.
Chapter 6 JavaScript: Introduction to Scripting
CHAPTER 4 CLIENT SIDE SCRIPTING PART 1 OF 3
Web Development & Design Foundations with HTML5
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
JavaScript (JS) Basics
Introduction to Scripting
JavaScript Syntax and Semantics
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
PHP Introduction.
JavaScript.
The structure of computer programs
Exercises on JavaScript & Revision
WEB PROGRAMMING JavaScript.
My First Web Page document.write("" + Date() + ""); To insert.
T. Jumana Abu Shmais – AOU - Riyadh
Tutorial 10: Programming with javascript
JavaScript: Introduction to Scripting
Web Programming– UFCFB Lecture 13
CS105 Introduction to Computer Concepts JavaScript
Presentation transcript:

CS105 Introduction to Computer Concepts Project

Code academy http://www.codecademy.com/courses/my-first-webpage/0/1 practice HTML+CSS

Build your static webpage Find a sample webpage e.g., http://www.htmlandcssbook.com/code-samples/chapter-17/example.html Make modifications

Build your dynamic webpage Using template http://www.cs.umb.edu/~yangmu/cs105/pizza/ Make modifications

JAVASCRIPT JavaScript is used in millions of Web pages to improve the design, validate forms, detect browsers, create cookies, and much more. JavaScript is the most popular scripting language on the internet, and works in all major browsers, such as Internet Explorer, Mozilla, Firefox, Netscape, Opera. 1/14/2019 CS105 Section 1 - Lecture 9 - 3

WHAT IS JAVASCRIPT? JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting language (a scripting language is a lightweight programming language) A JavaScript consists of lines of executable computer code A JavaScript is usually embedded directly into HTML pages JavaScript is an interpreted language (means that scripts execute without preliminary compilation) Everyone can use JavaScript without purchasing a license 1/14/2019 CS105 Section 1 - Lecture 9 - 3

Are Java and JavaScript the Same? NO! Java and JavaScript are two completely different languages in both concept and design! Java (developed by Sun Microsystems) is a powerful and much more complex programming language - in the same category as C and C++. 1/14/2019 CS105 Section 1 - Lecture 9 - 3

How to Put a JavaScript Into an HTML Page? <body> <script type="text/javascript"> document.write("Hello World!") </script> </body> </html> 1/14/2019 CS105 Section 1 - Lecture 9 - 3

Ending Statements With a Semicolon? With traditional programming languages, like C++ and Java, each code statement has to end with a semicolon (;). Many programmers continue this habit when writing JavaScript, but in general, semicolons are optional! However, semicolons are required if you want to put more than one statement on a single line. 1/14/2019 CS105 Section 1 - Lecture 9 - 3

JavaScript Variables Variables are used to store data. A variable is a "container" for information you want to store. A variable's value can change during the script. You can refer to a variable by name to see its value or to change its value. Rules for variable names: Variable names are case sensitive They must begin with a letter or the underscore character strname – STRNAME (not same) 1/14/2019 CS105 Section 1 - Lecture 9 - 3

Arithmetic Operators 1/14/2019 CS105 Section 1 - Lecture 9 - 3 Description Example Result + Addition x=2 4 y=2 x+y - Subtraction x=5 3 x-y * Multiplication 20 y=4 x*y / Division 15/5 5/2 2,5 % Modulus (division remainder) 5%2 1 10%8 2 10%2 ++ Increment x=6 x++ -- Decrement x=4 x-- 1/14/2019 CS105 Section 1 - Lecture 9 - 3

Assignment Operators Operator Example Is The Same As = x=y += x+=y x=x+y -= x-=y x=x-y *= x*=y x=x*y /= x/=y x=x/y %= x%=y x=x%y 1/14/2019 CS105 Section 1 - Lecture 9 - 3

Comparison Operators 1/14/2019 CS105 Section 1 - Lecture 9 - 3 Description Example == is equal to 5==8 returns false === is equal to (checks for both value and type) x=5 y="5"   x==y returns true x===y returns false != is not equal 5!=8 returns true > is greater than 5>8 returns false < is less than 5<8 returns true >= is greater than or equal to 5>=8 returns false <= is less than or equal to 5<=8 returns true 1/14/2019 CS105 Section 1 - Lecture 9 - 3

JavaScript Basic Examples document.write("Hello World!") </script>  format text with HTML code - heading alert("Hello World!") </script> 1/14/2019 CS105 Section 1 - Lecture 9 - 3

Example <script> x=“Hello World!” document.write(x) x=“String Example….” document.write(“Print x=” +x) </script>  use line break html code 1/14/2019 CS105 Section 1 - Lecture 9 - 3

JavaScript Popup Boxes Alert Box An alert box is often used if you want to make sure information comes through to the user. When an alert box pops up, the user will have to click "OK" to proceed. <script> alert("Hello World!") </script> 1/14/2019 CS105 Section 1 - Lecture 9 - 3

JavaScript Popup Boxes - 2 Confirm Box A confirm box is often used if you want the user to verify or accept something. When a confirm box pops up, the user will have to click either "OK" or "Cancel" to proceed. If the user clicks "OK", the box returns true. If the user clicks "Cancel", the box returns false. 1/14/2019 CS105 Section 1 - Lecture 9 - 3

JavaScript Popup Boxes - 3 Prompt Box A prompt box is often used if you want the user to input a value before entering a page. When a prompt box pops up, the user will have to click either "OK" or "Cancel" to proceed after entering an input value. If the user clicks "OK“, the box returns the input value. If the user clicks "Cancel“, the box returns null. 1/14/2019 CS105 Section 1 - Lecture 9 - 3

Prompt Box Example <script> x=prompt (“Enter a value:”, “ ”) document.write(“Value entered <br>”,+x) </script> 1/14/2019 CS105 Section 1 - Lecture 9 - 3

Conditional Statements Very often when you write code, you want to perform different actions for different decisions. You can use conditional statements in your code to do this. In JavaScript we have the following conditional statements: if statement - use this statement if you want to execute some code only if a specified condition is true if...else statement - use this statement if you want to execute some code if the condition is true and another code if the condition is false if...else if....else statement - use this statement if you want to select one of many blocks of code to be executed 1/14/2019 CS105 Section 1 - Lecture 9 - 3

Conditional Statements - 2 if (condition) { code to be executed if condition is true } else code to be executed if condition is not true 1/14/2019 CS105 Section 1 - Lecture 9 - 3

Conditional Statements Examples <script> x=3 if(x<0) { alert (“negative”) } else alert (“positive”) </script> 1/14/2019 CS105 Section 1 - Lecture 9 - 3

Adding 2 numbers using HTML input form http://employees.oneonta.edu/higgindm/javascript/AddNums Ex.html 1/14/2019 CS105 Section 1 - Lecture 9 - 3