Introduction to Programming JScript Six Scripting functions Discuss functions Password Example.

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

Introducing JavaScript
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.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
Tutorial 10 Programming with JavaScript
XP 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial 10.
Introduction to JavaScript for Python Programmers
WEB DESIGN AND PROGRAMMING Introduction to Javascript.
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.
Generations of Programming Languages First generation  Machine Language Second Generation  Assembly Language Third Generation  Procedural language such.
Database-Driven Web Sites, Second Edition1 Chapter 3 INTRODUCTION TO CLIENT-SIDE SCRIPTS.
JavaScript Part 1.
JavaScript Informatics for economists I. Introduction Programming language used in web pages. Simple and easy to use – written in HTML document. Client.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
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,
Introduction to Applets CS 3505 Client Side Scripting with applets.
Client Side Programming with JavaScript Why use client side programming? Web sides built on CGI programs can rapidly become overly complicated to maintain,
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. XP Objectives Learn the history of JavaScript Create a script element Understand basic JavaScript syntax Write.
Tutorial 10 Programming with JavaScript
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Dynamic Web Pages & JavaScript. Dynamic Web Pages Dynamic = Change Dynamic Web Pages are web pages that change. More than just moving graphics around.
Introduction to Client Side Scripting CS Client Side Scripting Client side means the Browser is interpreting the script Script is downloaded with.
CS346 Javascript -3 Module 3 JavaScript Variables.
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
Input & Output Functions JavaScript is special from other languages because it can accept input and produce output on the basis of that input in the same.
JavaScript Syntax, how to use it in a HTML document
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
JavaScript Making Web pages come alive. Objectives Be able to read JavaScript scripts Be able to write JavaScript scripts.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming basics.
 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.
JavaScript, Fourth Edition
4. Javascript M. Udin Harun Al Rasyid, S.Kom, Ph.D Lab Jaringan Komputer (C-307) Desain.
1 JavaScript in Context. Server-Side Programming.
JavaScript 1 COE 201- Computer Proficiency. Introduction JavaScript scripting language ▫Originally created by Netscape ▫Facilitates disciplined approach.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
CIS 3.5 Lecture 2.3 "Introduction to JavaScript".
1) PHP – Personal Home Page Scripting Language 2) JavaScript.
Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing a Line of Text in a Web Page 7.3 Another JavaScript.
Introduction to JavaScript CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams and also.
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.
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
CGS 3066: Web Programming and Design Spring 2016 Introduction to JavaScript.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
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.
 2001 Prentice Hall, Inc. All rights reserved. Outline 1 JavaScript.
CGS 3066: Web Programming and Design Spring 2017
>> Introduction to JavaScript
Chapter 6 JavaScript: Introduction to Scripting
Tutorial 10 Programming with JavaScript
JavaScript is a programming language designed for Web pages.
Barb Ericson Georgia Institute of Technology May 2006
Chapter 13 - JavaScript/JScript: Introduction to Scripting
Scope, Objects, Strings, Numbers
JavaScript Syntax and Semantics
JavaScript.
PHP.
Functions, Regular expressions and Events
JavaScript What is JavaScript? What can JavaScript do?
Tutorial 10 Programming with JavaScript
JavaScript What is JavaScript? What can JavaScript do?
Tutorial 10: Programming with javascript
JavaScript Basics What is JavaScript?
JavaScript is a scripting language designed for Web pages by Netscape.
Presentation transcript:

Introduction to Programming JScript Six Scripting functions Discuss functions Password Example

Elements of jScript Coding <!-- //1) Package Jscript --> // 6) start execution // 2) declare variables // 3) Input data // 4) Process data // 5) Output data // Jscript code > Pop ups Etc.

Scripting Functions Declare Script Packaging – … –Function() Define Variables and Allocate memory –var variable1name,variable2name; –HTML Object References (tagid.property.value) Input data –Window.prompt(), Process Data –parseInt(), +,-,*,/,if, if/else, for, … Output Data –document.writeln(), document.write(), window.alert() Start Execution ( Events) –onload, onclick, onmouseover

Syntax and Notation //comment { … } encapsulates program statements ;ends and separates all lines \Escape character –\n new line \t tab \” insert double quote Example –Window.write(“\”this \n is \n 3 lines \””) “this is 3 lines ” Case sensitive

Script Packaging Script inside tags Code inside HTML Comments Raw statements execute immediately Functions enclosed in curly brackets { } // is the Jscript comment <!-- document.writeln(“write immediately" ); function A(input) { document.writeln(“writewhen referenced" ); } // -->

Simple JScript Example Simple JScript Example <!-- // Script code in here document.writeln(" Welcome to JavaScript Programming! " ); // -->

Define Variables Use the var statement to define variables –var variable1name, variable2name; A variable name is the container for a value Scope –if defined outside a function the variable is global and can be used anywhere –If defined inside a function it is only meaningful inside the function HTML Object References can be used as variables var result = tagname.innertext; The result of functions can be used output variables var result = parseInt(“23”);

INPUT Special function –Returnvalue=window.prompt(“question”,def); HTML Object reference with tag ID – inner text –Reference the text inside the tag as tagname.innerText HTML Object reference with Form name – –Reference the input as formName.inputFieldName.value Eaxmple: var text = formName.inputFieldName.value;

Process Data Mathematical like assignment statements –Result = expression –Expression is some combination of variables and operators (Var1+var2)*var3 Operator examples +,-,*,/, Control Statements –Change the flow depending upon a condition Examples: if, if/else, for, … If(expression1 Operator Expression2) { If true do this}; If(10 10 is less than 11 ”}; –Operators ==,!=,>, =,<= Built in functions –parseFloat ( string), math.cos(rad),

Output Document.write(“HTML Code” + variable + “ more HTML Code”); –Html code between quotes –Variable : any value of a variable could be integer, float, string, function return or an HTML oject reference –Do not split lines inside quotes Document.writeln(“Html whole line”) adds a ne line Object reference assignment –Tagid.innertext = “print this line”

Start Execution Statements inside script tags are executed automatically when the page loads <!-- document.writeln(" this line is executed " ); // --> Functions are executed when referenced <!-- function A(input) { document.writeln(“only type”+input+”when referenced" ); } // --> Referenced by HTML Events in the body or from other functions – –function B(){ A(“ A is called”); }

Get JScripts from the Web Java scripts are relatively hard to write and harder to debug Many scripts are available free on the web Search for JavaScript source on your favorite search engine –Try –I got this clock examplethis clock example Since client side source is readily viewable You can copy most scripts directly from sites In most cases some editing is required –Need to know enough HTML and Jscript to do this