Introduction to Java. Script
Introduction What is it? l How does it work? l What is Java? l Learning Java. Script l l l Java. Script Statements Java. Script and HTML forms
What is Java. Script? l Browsers have limited functionality l Text, images, tables, frames Java. Script allows for interactivity l Browser/page manipulation l l l Reacting to user actions A type of programming language l l l Easy to learn Developed by Netscape Now a standard exists – www. ecma-international. org/publications/ standards/ECMA-262. HTM
Java. Script Allows Interactivity l Improve appearance l l Especially graphics Visual feedback Site navigation l Perform calculations l Validation of input l Other technologies l javascript. internet. com
How Does It Work? l Embedded within HTML page l l View source Executes on client l Fast, no connection needed once loaded Simple programming statements combined with HTML tags l Interpreted (not compiled) l l No special tools required
What is Java? Totally different l A full programming language l Much harder! l A compiled language l Independent of the web l Sometimes used together l
Learning Java. Script Special syntax to learn l Learn the basics and then use other people's (lots of free sites) l Write it in a text editor, view results in browser l You need to revise your HTML l You need patience and good eyesight! l
document. write('This is my" src="https://present5.com/presentation/842e99d7c1a5574a4408ae57bea3e753/image-8.jpg" alt="Java. Script Statements
My Page Note the symbol for line continuation
document. write('This is" src="https://present5.com/presentation/842e99d7c1a5574a4408ae57bea3e753/image-9.jpg" alt="Java. Script Statements My Page HTML written inside Java. Script
My Page My Page
Java. Script Statements
My Page My Page My Page
Java. Script written An Event inside HTML
window. prompt('Enter your name: ', ''); Another event" src="https://present5.com/presentation/842e99d7c1a5574a4408ae57bea3e753/image-11.jpg" alt="Example Statements Another event" />
Example Statements Another event
Note quotes: " and '
HTML Forms and Java. Script is very good at processing user input in the web browser l HTML
Forms and Java. Script document. formname. elementname. value Thus: document. addressform. yourname. value document. addressform. phone. value document. addressform. email. value
Tips Check your statements are on one line l Check your " and ' quotes match l Take care with capitalisation l Lay it out neatly - use tabs l Remember in the workbook denotes a continuing line l Be patient l Presentation slides adapted from scom. hud. ac. uk/scomsjw/Web%20 Authoring%20 Module/Lecture%20 Slides/introjs. ppt