Introduction To JavaScript. Putting it Together (page 11) All javascript must go in-between the script tags. All javascript must go in-between the script.

Slides:



Advertisements
Similar presentations
The Web Warrior Guide to Web Design Technologies
Advertisements

JavaScript (Part 2) CS 183 4/13/2010. JavaScript (Part 2) Will cover: ◦ For.. In ◦ Events ◦ Try.. Catch, Throw ◦ Objects.
Multimedia and the World Wide Web HCI 201 Lecture Notes #8B.
Chapter 7 © 2001 by Addison Wesley Longman, Inc. 1 Chapter 7 Sebesta: Programming the World Wide Web.
1 A Balanced Introduction to Computer Science, 2/E David Reed, Creighton University ©2008 Pearson Prentice Hall ISBN Chapter 7 Event-Driven.
Information Technology Center Hany Abdelwahab Computer Specialist.
(CS1301) Introduction to Computer Programming City Univ of HK / Dept of CS / Helena Wong 1. Overview of Programming and JavaScript - 1
Introduction To JavaScript What JavaScript Is: a general purpose scripting language that allows a static page to interact with users and respond to events.
Introduction to scripting
Web Programming Material From Greenlaw/Hepp, In-line/On-line: Fundamentals of the Internet and the World Wide Web 1 Introduction The JavaScript Programming.
1 Events Lect 8. 2 Event-driven Pages one popular feature of the Web is its interactive nature e.g., you click on buttons to make windows appear e.g.,
Javascript and the Web Whys and Hows of Javascript.
4.1 JavaScript Introduction
CNIT 133 Interactive Web Pags – JavaScript and AJAX Event and Event Handling.
Introduction to JavaScript. JavaScript Facts A scripting language - not compiled but interpreted line by line at run-time. Platform independent. It is.
Event Handlers CS101 Introduction to Computing. Learning Goals Learn about event handlers Determine how events are useful in JavaScript Discover where.
SYST Web Technologies SYST Web Technologies Lesson 6 – Intro to JavaScript.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
JavaScript Part 1.
1 CLIENT-SIDE SCRIPTS. Objectives 2 Learn how to reference objects in HTML documents using the HTML DOM and dot syntax Learn how to create client-side.
Chapter 3 : Processing on the Front End JavaScript Technically its name is ECMA-262, which refers to the international standard which defines it. The standard.
Internet Mark-up Languages CO32036 Part Lecture: Elementary JavaScript.
JavaScript 1. What is JavaScript? JavaScript allows web authors to create dynamic pages that react to user interaction. It is an Object-based because.
1 JavaScript. 2 What’s wrong with JavaScript? A very powerful language, yet –Often hated –Browser inconsistencies –Misunderstood –Developers find it painful.
DHTML: Dynamic HTML Internet Technology1. What is DHTML? A collection of enhancements to HTML ► To create dynamic and interactive websites Combination.
Javascript. Outline Introduction Fundamental of JavaScript Javascript events management DOM and Dynamic HTML (DHTML)
Lesson13. JavaScript JavaScript is an interpreted language, designed to function within a web browser. It can also be used on the server.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
Introduction to JavaScript Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan. 1.
CO1552 Web Application Development HTML Forms, Events and an introduction to JavaScript.
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.
Intro to JavaScript Scripting language –ECMAScript compliant –Client side vs. server side Syntactic rules –White space –Statement end: ; optional –Comments:
JavaScript, jQuery, and Mashups Incorporating JavaScript, jQuery, and other Mashups into existing pages.
Intro to JavaScript. Some simple examples Examples from our webpage Examples from Andrews webpage Today’s Example.
1 JavaScript
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
JavaScript Scripting language What is Scripting ? A scripting language, script language, or extension language is a programming language.
1 JavaScript 2 JavaScript. 2 Rollovers Most web page developers first use JavaScript for rollovers A rollover is a change in the appearance of an element.
Scott Marino MSMIS Summer Session Web Site Design and Authoring Session 8 Scott Marino.
JavaScript, Fourth Edition
Jaana Holvikivi 1 Introduction to Javascript Jaana Holvikivi Metropolia.
1 CSC160 Chapter 7: Events and Event Handlers. 2 Outline Event and event handlers onClick event handler onMouseOver event handler onMouseOut event handler.
Introduction into JavaScript Java 1 JavaScript JavaScript programs run from within an HTML document The statements that make up a program in an HTML.
Making dynamic pages with javascript Lecture 1. Java script java versus javascript Javascript is a scripting language that will allow you to add real.
JavaScript Challenges Answers for challenges
Event Handling. Objectives Using event handlers Simulating events Using event-related methods.
© 2007 D. J. ForemanJS-1 A Light Introduction for Non-programmers JavaScript for Beginners.
HTML FORMS The TEXT Object Presented By: Ankit Gupta.
CIS 3.5 Lecture 2.3 "Introduction to JavaScript".
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
Event Handling (the right way). A Simple Web Page Events - Summary The web page looks like this:
JavaScript Event Handlers. Introduction An event handler executes a segment of a code based on certain events occurring within the application, such as.
LESSON : EVENTS AND FORM VALIDATION -JAVASCRIPT. EVENTS CLICK.
Event Handlers Events are asynchronous. When an event occurs, JavaScript can execute code in response to the user’s action. This response to the user-initiated.
Chapter 5: Intro to Scripting CIS 275—Web Application Development for Business I.
Chapter 4 Java Script - Part1. 2 Outlines Introduction to Java Script Variables, Operators and Functions Conditional statements JavaScript Objects Forms.
JavaScript Events Java 4 Understanding Events Events add interactivity between the web page and the user You can think of an event as a trigger that.
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
JavaScript Events. Understanding Events Events add interactivity between the web page and the user Events add interactivity between the web page and the.
Web Programming Java Script-Introduction. What is Javascript? JavaScript is a scripting language using for the Web. JavaScript is a programming language.
 2001 Prentice Hall, Inc. All rights reserved. Outline 1 JavaScript.
Client-side (JavaScript) Validation. Associating a function with a click event – Part 1 Use the input tag’s onclick attribute to associate a function.
SE-2840 Dr. Mark L. Hornick 1 Dynamic HTML Handling events from DOM objects.
Java Script Introduction. Java Script Introduction.
JavaScript is a programming language designed for Web pages.
Javascript: variables and parameters
Event Driven Programming & User Defined Functions
JavaScript Basics What is JavaScript?
Presentation transcript:

Introduction To JavaScript

Putting it Together (page 11) All javascript must go in-between the script tags. All javascript must go in-between the script tags. javascript code </SCRIPT>

Outputting Text (page 12) Similar to Java we can output text to the screen. We do this by saying: Similar to Java we can output text to the screen. We do this by saying: document.write(“Hello World”); </SCRIPT>

Hiding Text in Javascript (page 30) Similar to Java you can comment sections of text or code out by simply saying: Similar to Java you can comment sections of text or code out by simply saying: // document.write(“You can’t See Me”); OR /* I don’t think You can see this section of code */

Variables (page 36) Assigning variables in Javascript is similar to Java Assigning variables in Javascript is similar to Java var PriceCandy; var TotalText=“Total”; var PriceDrink; var total=0; total = PriceCandy + PriceDrink;

Incorporating HTML Tags TO JavaScript (page 49) To output some text to the screen using a HTML tag we simply say: To output some text to the screen using a HTML tag we simply say: document.write(“ JavaScript Rules \n This is fun”); The \n acts as a new line in JavaScript NOT a break line.

Displaying your variables (page 61) To display your variable to the web page then: To display your variable to the web page then: var myheading=“This is my first Javascript”; var linktag=“ Web link ”; var text=“Hello”; var begineffect=“ ”; var endeffect=“ ”; document.write(myheading);document.write(linktag);document.write(begineffect);document.write(texty);document.write(endeffect);

Functions (page 70) Similar to Java we can declare functions. Similar to Java we can declare functions. function reallycool() { Javascript goes here }

Functions & Variables (page 76) We can also pass variable into a function as shown: We can also pass variable into a function as shown: var var1=“BMW M3”; var var2=“Chapel St”; function reallycool(var1,var2) { document.write(“My car is a “+var1+” and I drive it to “+var2); }

Result

Window Alerts (page 80) Like in DreamWeaver we can create pop up messages by simply saying: Like in DreamWeaver we can create pop up messages by simply saying: <window.alert(“This is an alert”); </script>

Window Alerts These can also be used for variables: These can also be used for variables: var num1=4; var thesum=num1+7; window.alert(thesum);

If Statements (page 142) We can also use “if” statements like in Java We can also use “if” statements like in Java var num1=0; var num2=0; if(num1==num2){window.alert(“True”);}else{window.alert(“False”);}

Switch Statement (page 153) Like in Java we have switch statements Like in Java we have switch statements var thename=“Fred”; switch(thename){ case “George” : window.alert(“George is an OK name”); break; case “Fred” : window.alert(“Fred rules”); break; default : window.alert(“Cool”);}

Loops – For (page 159) We also have the for loop We also have the for loopfor(count=1;count<11;count+=1){ document.write(“I am a loop”); }

Event Handler (page 176) We can add event handlers to HTML. The onClick Event We can add event handlers to HTML. The onClick Event Don’t Click Me Don’t Click Me

Event Handlers There are many of them like: There are many of them like: onMouseOut onMouseOut onLoad onLoad onUnload onUnload onFocus onFocus onBlur onBlur onChange onChange onSubmit onSubmit etc.. etc..

Opening New Windows (page 280) With javascript we can also open new windows, close them and even determine how they look: With javascript we can also open new windows, close them and even determine how they look: <input TYPE="button" VALUE="Open New Window“ onClick="NewWin=window.open('','NewWin', 'toolbar=no, status=no, width=200, height=100'); ">

Opens New Window

Window Attributes <input TYPE="button" VALUE="Open New Window" onClick="NewWin=window.open('','NewWin', onClick="NewWin=window.open('','NewWin','toolbar=no,status=no,width=200,height=100');"> </form>

Handling Strings bold() – adds and tags around a string value bold() – adds and tags around a string value chatAt() – finds out which character is at a given position in a string chatAt() – finds out which character is at a given position in a string concat()-adds two or more strings together and returns the new combined string value concat()-adds two or more strings together and returns the new combined string value fontcolor() – adds and tags around a string value, which change the size of the string to a specified size given as number; fontcolor() – adds and tags around a string value, which change the size of the string to a specified size given as number; indexOf() - searches for a character sent as a parameter in a string. If it’s found, the position of the first instance of the character is returned; otherwise, it returns –1; indexOf() - searches for a character sent as a parameter in a string. If it’s found, the position of the first instance of the character is returned; otherwise, it returns –1; replace() – finds out if a regular expression matches a string and then replaces a matched string with a new string; replace() – finds out if a regular expression matches a string and then replaces a matched string with a new string; substr() – allows a portion of the string specified with a start position and an ending position to be returned. substr() – allows a portion of the string specified with a start position and an ending position to be returned. ( more methods of string Object – page , the book)

JavaScript Doesn’t End There JavaScript is quite large scripting language so read your books and ensure that you look into all the different capabilities of JavaScript. JavaScript is quite large scripting language so read your books and ensure that you look into all the different capabilities of JavaScript. Useful links: Useful links: