JavaScript is a client-side scripting language. Programs run in the web browser on the client's computer. (PHP, in contrast, is a server-side scripting.

Slides:



Advertisements
Similar presentations
17 HTML, Scripting, and Interactivity Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and.
Advertisements

Samsung Smart TV is a web-based application running on an application engine installed on digital TVs connected to the Internet.
WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
1 Web Site Design Overview of the Internet Cookie Setton.
JavaScript and AJAX Jonathan Foss University of Warwick
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
A really fairly simple guide to: mobile browser-based application development (part 1) Chris Greenhalgh G54UBI / Chris Greenhalgh
The Web Warrior Guide to Web Design Technologies
Languages for Dynamic Web Documents
MSc. Publishing on WWW JavaScript. What is JavaScript? A scripting language devised by Netscape Adds functionality to web pages by: Embedding code into.
Web Page Development Identify elements of a Web Page Start Notepad
CM143 - Web Week 2 Basic HTML. Links and Image Tags.
Macromedia Dreamweaver 4 Advanced Level Course. Add Rollovers Rollovers or mouseovers are possibly the most popular effects used in designing Web pages.
JavaScript 101 Lesson 5: Introduction to Events. Lesson Topics Event driven programming Events and event handlers The onClick event handler for hyperlinks.
Inline, Internal, and External FIle
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
JavaScript & jQuery the missing manual Chapter 11
JavaScript Teppo Räisänen LIIKE/OAMK HTML, CSS, JavaScript HTML defines the structure CSS defines the layout JavaScript is used for scripting It.
Languages in WEB Presented by: Jenisha Kshatriya BCM SS09.
© Cheltenham Computer Training 2001 Macromedia Dreamweaver 4 - Slide No 1 Macromedia Dreamweaver 4 Advanced Level Course.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
Advanced Web Design Scripting Tutorial Chapters. Scripting Intro The scripting part of the forthcoming Advanced Web Design textbook introduces you to.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
XP New Perspectives on Browser and Basics Tutorial 1 1 Browser and Basics Tutorial 1.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
JavaScript is a client-side scripting language. Programs run in the web browser on the client's computer. (PHP, in contrast, is a server-side scripting.
DHTML: Dynamic HTML Internet Technology1. What is DHTML? A collection of enhancements to HTML ► To create dynamic and interactive websites Combination.
D2L Notes Be sure to submit your link in the dropbox provided on D2L You can just upload an empty text file if a file upload is required Do not use D2L.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and check boxes using HTML Add a pull-down.
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. What is HTML? HTML is a language for describing web pages. HTML stands for Hyper Text Markup Language HTML is not a programming language,
JavaScript, Fourth Edition
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
A Basic Guide to Using Wikispaces Jeff Rew TEDU 673.
Introduction.  The scripting language most often used for client-side web development.  Influenced by many programming languages, easier for nonprogrammers.
JavaScript - A Web Script Language Fred Durao
Dynamic web content HTTP and HTML: Berners-Lee’s Basics.
Lecture 10 JavaScript: DOM and Dynamic HTML Boriana Koleva Room: C54
Introduction to the Document Object Model DOM *Understand document structure manipulation *Dynamic effects in web pages *Programming, scripting, web content.
Introduction to JavaScript CS101 Introduction to Computing.
Overview of Form and Javascript fundamentals. Brief matching exercise 1. This is the software that allows a user to access and view HTML documents 2.
1 CSC160 Chapter 7: Events and Event Handlers. 2 Outline Event and event handlers onClick event handler onMouseOver event handler onMouseOut event handler.
WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: Variables, Functions and Events (NON-Audio version) © Dr. David C. Gibbs WDMD.
HTML Forms.
Web Authoring with Dreamweaver. Unit Objectives  Be able to define keywords: HTML, HTTP (protocol), browser, web server, client/server, tag, attribute,
Javascript Overview. What is Javascript? May be one of the most popular programming languages ever Runs in the browser, not on the server All modern browsers.
Web Programming Overview. Introduction HTML is limited - it cannot manipulate data How Web pages are extended (include): –Java: an object-oriented programming.
Understanding JavaScript and Coding Essentials Lesson 8.
Document Object Model Nasrullah. DOM When a page is loaded,browser creates a Document Object Model of the Page.
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
By Collin Donaldson. Hacking is only legal under the following circumstances: 1.You hack (penetration test) a device/network you own. 2.You gain explicit,
1 Using jQuery JavaScript & jQuery the missing manual (Second Edition)
Web Programming Java Script-Introduction. What is Javascript? JavaScript is a scripting language using for the Web. JavaScript is a programming language.
Dreamweaver - Forms questionnaire, register, login, etc.
XP Creating Web Pages with Microsoft Office
A little PHP. Enter the simple HTML code seen below.
Introduction to.
Javascript and Dynamic Web Pages: Client Side Processing
Applied Component I Unit II Introduction of java-script
Using JavaScript to Show an Alert
Section 17.1 Section 17.2 Add an audio file using HTML
DHTML Javascript Internet Technology.
DHTML Javascript Internet Technology.
Secure Web Programming
Teaching slides Chapter 6.
Introduction to Programming and JavaScript
Introduction to Web programming
Presentation transcript:

JavaScript is a client-side scripting language. Programs run in the web browser on the client's computer. (PHP, in contrast, is a server-side scripting language... programs run on the web server computer) A program in the client's browser can do various useful tasks: - validating user input to text boxes in on-screen forms - modifying parts of the web page, e.g. in response to user actions (DHTML) - fetching data items from the server, as a background task (AJAX) Doing work on the client computer can speed-up Web Database Applications.. avoids data transfer delays and server workload delay. We need to know about JavaScript in order to use the Google Maps API.. and also to use AJAX.

JavaScript programs are included in web pages.. in two alternative ways: 1. As program code inside a.. element (between these two tags). 2. As a separate.JS program that is included as the page loads. >example An HTML document has a.. section and a.. section. -- the body section contains the information displayed on screen -- the head contains various definitions. JavaScript can be embedded in the head or the body of a web page.. but behaves differently in each case: Code in the body section is executed immediately, as the program loads Code in the head is a collection of function definitions, to be called later.. e.g. when particular events occur. >headbody

JavaScript can be used to respond to eventsevents ChapterChapter on event handling. example of onClick event. Example2 for onClickonClick JavaScript in anchor taganchor tag Attaching a handler function to an event, 2 wayshandler2 ways MeasuringMeasuring time intervals

Hello HTML tags can have IDs: This allows JavaScript to change parts of the web page: <input type='button' value='make Hello blue' onClick='JavaScript: document.getElementById("hello").color="blue" ' > As well as reading properties of the tag.. Including properties such as the position and area occupied by the tag’s object on the web page on screen. example

clock1clock1, clock2, clock3, clock4 use the setInterval() window function.clock2clock3clock4 Clock4Clock4 uses the browser’s TITLE BAR and clock1B-2 show formatting (CSS for the text box properties). ExampleExample uses setTimeout() instead of setInterval(), and shows a scrolling titlebar. The blinking eyes examples: 1 and then 2 demonstrate use of time intervals.12 errorReportingerrorReporting using try{ } and catch(e){ }. backgroundColour.htmlbackgroundColour.html shows the way screen object properties can be changed:.. a button flashes because its background colour is changed at regular intervals. mover.htmlmover.html extends the idea: the position of an object on screen can be moved. Click the image.. it disappears.. the innerHtml of an html element has been changed.. so a subtree in the html DOM tree has changed. JAVASCRIPT EXAMPLE PROGRAMS

iframeExample.html JAVASCRIPT EXAMPLE PROGRAMS Opening and controlling another window in the browseranother window Course lecnotes web pageCourse lecnotes web page: do not click, etc.

Using the Google Maps API This online API allows people to display maps of places, free of charge, on web pages.. Including zoom in and out and aerial photographs... Like the example on this web page.this web page In order to use the API you must first REGISTER at the website: Click the link on that page to sign up, agree to the conditions of use, and get a KEY.. A KEY is a unique sequence of characters that identify you.. It will only work on the website you gave when you signed up. Sign in with your Google login.. Or create one if you haven’t already got one Password must be 8 characters long Use a real address because they send you a message that you have to confirm Copy your character string key and save it somewhere safe. Then copy the code in the JavaScript Maps API Example text box and paste it into an html document (i.e. put before it in a text editor, and save the file as a file named firstmap.html

The first part of the copied code looks like this: <script src= " This identifies the JavaScript file that contains all the function definitions for the maps. It also contains your unique KEY string in the appropriate place. Also remove this JavaScript comment or it will appear on your web page: // Note: you will need to replace the sensor parameter below with either an explicit true or false value. The code in your new html document so far just provides the API. Now you need to add your own code to use the functions provided by the API. Change the substring sensor=true_or_false to sensor=false To get you started, copy the following code (also on the CE205 assignment 3 web page as googlemaps.txt to copy and paste). - Paste it at the end of your html document in the text editor... It completes the html document, so after saving the file you can double-click the filename to open the web page and admire the map.

function initialise() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map_canvas")); map.setCenter(new GLatLng( , ), 13); map.setUIToDefault(); } This is the text of the additional code to get your web page working It has a function named initialise( ) that goes into the head part of the html document.. That function is called by the onLoad event (when the web page opens).. Notice that another function is called when the web page is closed, but that function is already defined in the API: GUnload( )... Google API function names start with a capital G.

More about Google Maps From the google maps folder in the course web page.. Text file describes the nine example web pages in that folder MapsMaps: shows the initial map of Stanford University, Palo Alto in California.. Where Google began. This is the map when google maps is first set up as described above. Map2Map2 sets the initial map to Colchester by changing the latitude and longitude values in the function call: map.setCenter(new GLatLng( , ), 13); Map3Map3 extends the idea of Lat and Long values by providing text boxes on the web page so that users can change Latitude and Longitude and call the GLatLng( ) function by pressing the 'move' button on screen. Map3 also shows how to add a marker overlay to a specified point on the map: var marker = new GMarker(position); map.addOverlay(marker); //add a marker at the specified coordinates It also shows how to use the map.setCenter( ) function to move the mapped location within an existing map in a web page. The map.setCenter( ) function takes 2 arguments: a Lat,Lng pair and a magnification value. But the zoom level attribute seems to be ignored, as this web page example shows.

Map4Map4 shows the use of a Geocoder to convert address to LatLng values. The map starts in Palo Alto but the address box allows a new location to be chosen by typing the address into the box and clicking the button. One geocoder object is required. It is created as a global variable: var geocoder = null; geocoder = new GClientGeocoder(); geocoder.getLatLng( address, function(point) { if (!point) { alert(address + " not found"); } else { map.setCenter(point, 13); var marker = new GMarker(point); map.addOverlay(marker); } );

Map5Map5 shows how an Infobox can be added to a marker to display information about the marked point on the map. var marker = new GMarker(point); map.addOverlay(marker); marker.openInfoWindowHtml(address); Map6Map6 starts the map with a marker and infobox displayed. Link on page to further info on the Google Maps website. Map8 also show the map.closeInfoWindow() method closing the info window attached to a marker on the map and also the more general map.clearOverlays() method. Map8Map8 shows how to use setZoom( ) to zoom in or out. The user input via the TEXTBOX is text, so has to be converted to a number before it will work in setZoom( ). Map7Map7 show the use of getZoom( ) to find out and display the current zoom level. Change the level using the + and - controls on the map and click the show button to show the current zoom level.

Map9 enables the Google 'Search the map' box at the bottom of the map by calling the map.enableGoogleBar() method. It zooms in automatically when things on the current map are sought. This search box can be removed by calling the map.disableGoogleBar() method. another example of a listener: GEvent.addListener(map, "click", function() { alert("You clicked the map."); }); Uses the map event zoomend(oldLevel:Number, newLevel:Number) by adding an event listener to the initialisation function for the map: GEvent.addListener(map, "zoomend", function() { document.getElementById("zoomlevel").value = map.getZoom(); });