Netscape Introduction to the JavaScript Language

Similar documents
5. JavaScript Basics

INTRODUCTION TO WEB DEVELOPMENT AND HTML. Lecture 13: Intro to JavaScript - Spring 2011

JavaScript!= Java. Intro to JavaScript. What is JavaScript? Intro to JavaScript 4/17/2013 INTRODUCTION TO WEB DEVELOPMENT AND HTML

Indian Institute of Technology Kharagpur. Javascript Part III. Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. I.I.T.

By the end of this section of the practical, the students should be able to:

8/19/2018. Web Development & Design Foundations with HTML5. Learning Objectives (1 of 2) Learning Objectives (2 of 2) What is JavaScript?

INTRODUCTION TO COMPUTER PROGRAMMING. Richard Pierse. Class 9: Writing Java Applets. Introduction

New Perspectives on Creating Web Pages with HTML. Tutorial Objectives

Web Development & Design Foundations with HTML5

By the end of this section of the practical, the students should be able to:

CHAPTER 6 JAVASCRIPT PART 1

Goals. Java - An Introduction. Java is Compiled and Interpreted. Architecture Neutral & Portable. Compiled Languages. Introduction to Java

Working with JavaScript

Content Security Policy

Web Development & Design Foundations with HTML5, 8 th Edition Instructor Materials Chapter 14 Test Bank

Introduction to using HTML to design webpages

1.264 Lecture 12. HTML Introduction to FrontPage

JavaScript code is inserted between tags, just like normal HTML tags:

UNIT 3 SECTION 1 Answer the following questions Q.1: What is an editor? editor editor Q.2: What do you understand by a web browser?

JavaScript and XHTML. Prof. D. Krupesha, PESIT, Bangalore

A.A. 2008/09. Why introduce JavaScript. G. Cecchetti Internet Software Technologies

JavaScript Specialist v2.0 Exam 1D0-735

1$ 5 ! $ 6 4 * Source: 0 "!*! 0! * 8 97 ?!$ 5 0 *! 4! $ 0 : * ' () 7;7 7<7

(Refer Slide Time: 01:40)

Software. Programming Languages. Types of Software. Types of Languages. Types of Programming. Software does something

ADF Code Corner. 71. How-to integrate Java Applets with Oracle ADF Faces. Abstract: twitter.com/adfcodecorner

Chapter4: HTML Table and Script page, HTML5 new forms. Asst. Prof. Dr. Supakit Nootyaskool Information Technology, KMITL

710 Index Attributes, 127 action attribute, 263 assigning, bottom attribute, domain name attribute, 481 expiration date attribute, 480 8

INDEX. Note: Boldface numbers indicate illustrations 333

What Is JavaScript? A scripting language based on an object-orientated programming philosophy.

Client Side Security And Testing Tools

CISH-6510 Web Application Design and Development. Overview of JavaScript. Overview

UI Course HTML: (Html, CSS, JavaScript, JQuery, Bootstrap, AngularJS) Introduction. The World Wide Web (WWW) and history of HTML

Lecture 14. Introduction to JavaScript. Mr. Mubashir Ali Lecturer (Dept. of Computer Science)

CITS3403 Agile Web Development Semester 1, 2018

INFS 2150 Introduction to Web Development and e-commerce Technology. Programming with JavaScript

Objectives. Introduction to JavaScript. Introduction to JavaScript INFS Peter Y. Wu, RMU 1

Simple Form Documentation

JavaScript CS 4640 Programming Languages for Web Applications

Using ImageZoom 2. Zoom In. Quick Zoom In: To double the size of the image, click on the point that you want to zoom in.

CGI Programming. What is "CGI"?

CERTIFICATE IN WEB PROGRAMMING

JavaScript: Introduction, Types

CHAPTER 2 MARKUP LANGUAGES: XHTML 1.0

Produced by. App Development & Modeling. BSc in Applied Computing. Eamonn de Leastar

Module 5 JavaScript, AJAX, and jquery. Module 5. Module 5 Contains 2 components

Dynamism and Detection

1. Cascading Style Sheet and JavaScript

Fundamentals of Website Development

Module 5 JavaScript, AJAX, and jquery. Module 5. Module 5 Contains an Individual and Group component

COMP519 Web Programming Lecture 16: JavaScript (Part 7) Handouts

CSC Web Programming. Introduction to JavaScript

COMS 469: Interactive Media II

JavaScript CS 4640 Programming Languages for Web Applications

COMS 359: Interactive Media

EXERCISE: Introduction to client side JavaScript

Client vs Server Scripting

Ch04 JavaServer Pages (JSP)

COMS 469: Interactive Media II

Shwetank Kumar Gupta

Session 16. JavaScript Part 1. Reading

E ECMAScript, 21 elements collection, HTML, 30 31, 31. Index 161

Q1. What is JavaScript?

Chapter 15 Plug-ins, ActiveX, and Applets

CIW 1D CIW JavaScript Specialist.

COMS 469: Interactive Media II

JavaScript by Vetri. Creating a Programmable Web Page

write vs. writeln Prompting as Page Loads Today s Goals CSCI 2910 Client/Server-Side Programming Intermediate File vs. HTML Output

CRAWLING THE CLIENT-SIDE HIDDEN WEB

Session 6. JavaScript Part 1. Reading

5.4 JavaScript Objects and Methods

Venkateshwar International School Sector-18, Dwarka, New Delhi-78 SAT- PRELIMINARY ROUND Class XII

INTRODUCTION TO JAVASCRIPT

ACCUZIP EDDM UI REST API CALLS. 100% Cloud Based EDDM List Creation. Abstract EDDM UI to select Carrier Route Boundaries throughout the United States

Client-side Processing

13. Databases on the Web

Lecture 5. Connecting Code to Web Page Events

Outline. Introduction to Java. What Is Java? History. Java 2 Platform. Java 2 Platform Standard Edition. Introduction Java 2 Platform

Chapter 16. JavaScript 3: Functions Table of Contents

Introduction to JavaScript p. 1 JavaScript Myths p. 2 Versions of JavaScript p. 2 Client-Side JavaScript p. 3 JavaScript in Other Contexts p.

5. Strict mode use strict ; 6. Statement without semicolon, with semicolon 7. Keywords 8. Variables var keyword and global scope variable 9.

Static Webpage Development

Comprehensive AngularJS Programming (5 Days)

Come & Join Us at VUSTUDENTS.net

Lesson 5: Introduction to Events

JavaScript and Events

HTML TAG SUMMARY HTML REFERENCE 18 TAG/ATTRIBUTE DESCRIPTION PAGE REFERENCES TAG/ATTRIBUTE DESCRIPTION PAGE REFERENCES MOST TAGS

Web development using PHP & MySQL with HTML5, CSS, JavaScript

LECTURE-2. Functions review HTML Forms. Arrays Exceptions Events. CS3101: Scripting Languages: Javascript Ramana Isukapalli

Forms, Form Events, and Validation. Bok, Jong Soon

CST272 Getting Started Page 1

Computational Applications in Nuclear Astrophysics using Java Java course Lecture 1

JavaScript. What s wrong with JavaScript?

Manual Html A Href Onclick Submit Form

Outline of Lecture 5. Course Content. Objectives of Lecture 6 CGI and HTML Forms

A Balanced Introduction to Computer Science, 3/E

Agenda. My Introduction. CIS 154 Javascript Programming

Brief Intro to Firebug Sukwon Oh CSC309, Summer 2015

c122mar413.notebook March 06, 2013

Java Applets, etc. Instructor: Dmitri A. Gusev. Fall Lecture 25, December 5, CS 502: Computers and Communications Technology

Transcription:

Netscape Introduction to the JavaScript Language

Netscape: Introduction to the JavaScript Language Eckart Walther Netscape Communications

Serving Up: JavaScript Overview Server-side JavaScript LiveConnect: Integrating JavaScript, Java Applets & Native Code Future Directions

What Is JavaScript? JavaScript is an object-based scripting language designed to add programmatic capabilities and cross platform scripting of events, objects, and methods to web pages.

Java vs. JavaScript JavaScript Java Interpreted (not compiled) bycompiled on server before client. execution on client. Object-based. Code uses built-in, Object-oriented. Applets cons extensible objects, but no classes of object classes with inheritan or inheritance. Code integrated with, and embedded in, HTML. Applets distinct from HTML (accessed from HTML pages) Variable data types not declared Variable data types must be (loose typing). declared (strong typing) Dynamic binding. Object Static binding. Object referenc references checked at run-time. must exist at compile-time.

What Does it Taste Like? Use <SCRIPT> tag Built-in objects, properties extend HTML & reflect document content: Objects: window, frames, document, form, form elements Properties: document.bgcolor, document.lastmodified Methods: document.write(), window.open() Form element event-handlers: onclick, onfocus

A Simple JavaScript <HTML> <HEAD> <SCRIPT LANGUAGE= JavaScript > <!-- hide script from old browsers document.write( Welcome to ); // end the hiding here --> </SCRIPT> </HEAD> <BODY> JavaOne! </BODY> </HTML>

JavaScript Functions Generally defined in HEAD Stored and executed by events in the page <HEAD><SCRIPT LANGUAGE= JavaScript > function square( x ) { return x * x; } document.write( The function returned, square( 5 ),. ); </SCRIPT></HEAD>

Events <TAG eventhandler= JavaScript Code > e.g., <INPUT TYPE= button VALUE= Calculate onclick= compute( this.form ) > Focus, Blur, Change events: text fields, textareas, and selections Click events: buttons, radio buttons, checkboxes, submit buttons, reset buttons, links Select events: text fields, textareas MouseOver events: links

Functions & Events <HEAD> <SCRIPT LANGUAGE= JavaScript > function compute( form ) { if( confirm( Are you sure? ) ) form.result.value = eval( form.expr.value ); else alert( Please come back again ); } </SCRIPT> </HEAD> <BODY> <FORM> Enter an expression: <INPUT TYPE= text NAME= expr SIZE=15 > <INPUT TYPE= button VALUE= Calculate ONCLICK= compute( this.form ) > <BR> Result: <INPUT TYPE= text NAME= result SIZE=15 > </BR> </FORM> </BODY>

Objects Window, Child windows: Top-level object and frame windows window.open( doc1.html ) Location: current URL location.href = "http://www.terrapin.com/samples/vsimple.html" History: previous URLs history.length = 7 Document: title, background color document.myform.button1.value = Press Me

Server-Side JavaScript Executes on the server to satisfy an HTTP request Includes pre-defined objects Includes built-in functions Maintains state across requests

HTTP Request: Execution Viewpoint 1. Server receives request 2. Server checks with JavaScript Run-Time to see if it wants the request 3. Server turns the request over to JavaScript 4. JavaScript reads a pre-digested form of the HTML page (including JavaScript bytecodes) from a binary file 5. JavaScript attaches built-in objects with the JavaScript context 6. JavaScript interprets the pre-digested form of the page

HTML with JavaScript: Request Object <HTML> <HEAD> <TITLE> Hello World </TITLE> </HEAD> <BODY> <H1> Hello World </H1> <P> Your IP Address is <SERVER> write(request.ip) </SERVER> </BODY> </HTML>

Pre-Defined Objects Server Project Client Request Database

Build-In Functions defined write flush redirect debug registercfunction

Connecting All the Pieces

Integrating JavaScript and Java JavaScriptFJava: Full reflection of public Java methods and variables in JavaScript <APPLET CODE=Hello.class NAME=helloApplet WIDTH=60 HEIGHT=30> <PARAM NAME=label VALUE=test> </APPLET> You could reference it in JavaScript as follows: document.helloapplet; document.applets["helloapplet"];

Integrating JavaScript and Java (cont.) JavaScriptFJava: Access to Java packages and static information var System = Packages.java.lang.System; System.err.println("Greetings from JavaScript"); Use the getclass method to access static variables and methods. E.g., var MyApplet = getclass(document.nervousapplet); // set a static variable MyApplet.textSize = 14;

Integrating JavaScript and Java (cont.) JavaFJavaScript: JSObject: JavaScript objects reflected into Java import netscape.javascript.*; Object[] args = new Object[1]; args[0] = new Integer(4); JSObject.getWindow( this ).call("square", args);

Integrating JavaScript and Native Components Java Runtime Interface (JRI) standard interface to Java services Platform independent native methods Calling a Plug-In from JavaScript <EMBED name=avi WIDTH=150 HEIGHT=150 SRC= "1204ride.avi">... <A HREF="#" onclick="document.avi.play()">

Defining Native Methods In Java: class AviPlugin extends Plugin { public native void play(); } javah generates C/C++ header file In C/C++: void native_aviplugin_play(jrienv* env, jref plugin) {... }

Future Directions Even tighter Integration between JavaScript and Java More events, objects, and functions Security-Data Tainting Integration with JavaBeans framework

Q & A More Information about JavaScript http://home.netscape.com/eng/mozilla/3.0/ handbook/javascript/index.html