Programming with JavaScript (Chapter 10). XP Various things Midterm grades: Friday Winter Career Fair – Thursday, April 28, 2011 (11 am to 3 pm). – MAC.

Slides:



Advertisements
Similar presentations
JavaScript I. JavaScript is an object oriented programming language used to add interactivity to web pages. Different from Java, even though bears some.
Advertisements

1 What is JavaScript? JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting language A scripting language is a lightweight.
Introducing JavaScript
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
1 CSC 551: Web Programming Spring 2004 client-side programming with JavaScript  scripts vs. programs  JavaScript vs. JScript vs. VBScript  common tasks.
COM311H Zheng, School of C&M, UUJ1 Dynamic Web Authoring JavaScript Basics (Array and Function)
The Web Warrior Guide to Web Design Technologies
2440: 211 Interactive Web Programming JavaScript Fundamentals.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
JavaScript Friend or Foe?. History of Java and JavaScript Oak and Coffee? ECMAscript European Computer Manufacturers Association JScript?
Tutorial 10 Programming with JavaScript
HTML Recall that HTML is static in that it describes how a page is to be displayed, but it doesn’t provide for interaction or animation. A page created.
XP 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial 10.
Information Technology Center Hany Abdelwahab Computer Specialist.
XP Tutorial 1 New Perspectives on JavaScript, Comprehensive1 Introducing JavaScript Hiding Addresses from Spammers.
2012 •••••••••••••••••••••••••••••••••• Summer WorkShop Mostafa Badr
JavaScript CMPT 281. Outline Introduction to JavaScript Resources What is JavaScript? JavaScript in web pages.
4.1 JavaScript Introduction
JavaScript: Control Structures September 27, 2005 Slides modified from Internet & World Wide Web: How to Program (3rd) edition. By Deitel, Deitel,
WEB DESIGN AND PROGRAMMING Introduction to Javascript.
CS346 - Javascript 1, 21 Module 1 Introduction to JavaScript CS346.
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan.
WEEK 3 AND 4 USING CLIENT-SIDE SCRIPTS TO ENHANCE WEB APPLICATIONS.
CSC 330 E-Commerce Teacher Ahmed Mumtaz Mustehsan Ahmed Mumtaz Mustehsan GM-IT CIIT Islamabad GM-IT CIIT Islamabad CIIT Virtual Campus, CIIT COMSATS Institute.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
Javascript. Outline Introduction Fundamental of JavaScript Javascript events management DOM and Dynamic HTML (DHTML)
1 JavaScript in Context. Server-Side Programming.
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
Tutorial 10 Programming with JavaScript. XP Objectives Learn the history of JavaScript Create a script element Understand basic JavaScript syntax Write.
Tutorial 10 Programming with JavaScript
Done by: Hanadi Muhsen1 Tutorial 1.  Learn the history of JavaScript  Create a script element  Write text to a Web page with JavaScript  Understand.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
Introduction.  The scripting language most often used for client-side web development.  Influenced by many programming languages, easier for nonprogrammers.
Javascript. What is JavaScript? Scripting (interpreted) language designed for the web Beware: JavaScript is case sensitive.
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
การสคริปท์ฝั่งลูกข่ายด้วย JavaScript การเขียนโปรแกรมเว็บ.
Dr. Qusai Abuein1 Internet & WWW How to program Chap.(6) JavaScript:Introduction to Scripting.
1 JavaScript
JavaScript Syntax, how to use it in a HTML document
JavaScript Scripting language What is Scripting ? A scripting language, script language, or extension language is a programming language.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming basics.
JavaScript. JavaScript is the programming language of HTML and the Web. Easy to learn One of the 3 languages of all developers MUST learn: 1. HTML to.
XP Tutorial 10 Section 1 1 Programming with JavaScript.
Web111a_chapt08.ppt HTML: Section 8 JavaScript CGI Programs (Server Side programs) Common Gateway Interface Run on server Communicate with user across.
1 Server versus Client-Side Programming Server-SideClient-Side.
Introduction into JavaScript Java 1 JavaScript JavaScript programs run from within an HTML document The statements that make up a program in an HTML.
1 JavaScript in Context. Server-Side Programming.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
JavaScript. JavaScript Introduction JavaScript is the world's most popular programming language. It is the language for HTML and the web, for servers,
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
JavaScript and AJAX 2nd Edition Tutorial 1 Programming with JavaScript.
XP Tutorial 10New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
© 2010 Robert K. Moniot1 Chapter 6 Introduction to JavaScript.
Tutorial 10 Programming with JavaScript
JavaScript an introduction.
Objectives Insert a script element Write JavaScript comments
T. Jumana Abu Shmais – AOU - Riyadh
Tutorial 10 Programming with JavaScript
JavaScript.
Tutorial 10: Programming with javascript
An Introduction to JavaScript
CIS 136 Building Mobile Apps
Presentation transcript:

Programming with JavaScript (Chapter 10)

XP Various things Midterm grades: Friday Winter Career Fair – Thursday, April 28, 2011 (11 am to 3 pm). – MAC Gym, Wade King Student Rec Center – – bring resumes, dress in business attire, and research participating employers in advance.

XP Objectives The script element script Basic JavaScript syntax Write text to a Web page with JavaScript JavaScript data types and variables Create and call a JavaScript function Access an external JavaScript file Add comments to JavaScript code Basic debugging techniques and tools Example of a Javascript applicationJavascript application Examples of document.write()document.write() Lab4 at LAB 3 ANSWERS csci 2023

XP The Development of JavaScript Server-side vs Client-side programming JavaScript is a subset of Java Differences between Java and JavaScript: – Java is a compiled language – JavaScript is an interpreted language JavaScript csci 2024

XP Comparing Java and JavaScript csci 2025

XP The Development of JavaScript Jscript is an IE version of JavaScript ECMA – European Computer Manufacturers Association – develops scripting standards – The standard is called ECMAScript (aka JavaScript) csci 2026

XP Working with the Script Element JavaScript code can either be placed – directly in a Web page file or – saved in an external text file Insert a client-side script in a Web page when using the script element script commands csci 2027

XP Writing Output to the Web Page Object: any item Method: a process by which JS accesses properties of an object To write text to a Web page, use the following JS code: document.write(“text”); or document.writeln(“text”)’ where text is the content to be written to the page. csci 2028

XP Understanding JavaScript Syntax JavaScript is case sensitive Ignores most occurrences of extra white space Do not break a statement into several lines The + symbol used in this command combines several text strings into a single text string csci 2029

XP Declaring a JavaScript Variable Variable: named item designed to store information – JS programs use variables to represent values and text strings You can declare variables with any of the following JavaScript commands: var variable; var variable = value; variable = value; where variable is the name of the variable and value is the initial value of the variable. csci 20210

XP Working with Variables and Data JavaScript variable types: – Numeric variables – String variables – Boolean variables – Null variables You must declare a variable before using it csci 20211

XP Working with Variables and Data Numeric variable: – any number, such as 13, 22.5, etc. – can also be expressed in scientific notation String variable: – any group of characters, such as “Hello” or “Happy Day!” – Must be enclosed within either double or single quotes Boolean variable – accepts only true and false values Null variable – has no value at all csci 20212

XP Working with Variables and Data JavaScript is a weakly typed language The + symbol can be used with either numeric values or text strings var total = 5 + 4; var emLink = "cadler" + + "mpl.gov"; csci 20213

XP Creating a JavaScript Function A function is a collection of commands that performs an action or returns a value A function name identifies a function Parameters are values used by the function The function is executed only when called by another JavaScript command function_name(parameter values) csci 20214

XP Creating a JavaScript Function csci 20215

XP Creating a Function to Return a Value For a function to return a value, it must include a return statement function function_name(parameters){ JavaScript commands return value; } csci 20216

XP Accessing an External JavaScript File The code to access an external script file is: Place all script elements that reference external files in the document head csci 20217

XP Commenting JavaScript Code Commenting your code is very important // comment rest of line Or /* comment block with many lines */ csci 20218

XP Using Comments to Hide JavaScript Code <!--Hide from nonJavaScript browsers JavaScript commands // Stop hiding from older browsers --> csci 20219

XP Debugging Your JavaScript Programs Debugging is the process of searching code to locate a source of trouble There are three types of errors: – Load-time errors – Run-time errors – Logical errors csci 20220

XP Debugging Your JavaScript Programs Microsoft: Microsoft Script Debugger Firefox: Firefox Error Console Modular code entails breaking up a program’s different tasks into small, manageable chunks An alert dialog box can be generated to display a text message with an OK button alert(text); csci 20221