C ITS 1231 Web Tec hnolog ies. JavaScript: Document, Event, Date objects
|
|
- Logan O’Connor’
- 6 years ago
- Views:
Transcription
1 C ITS 1231 Web Tec hnolog ies JavaScript: Document, Event, Date objects
2 D oc um ent O bjec t JavaScript can interact with HTML page elements via the Document Object. The Document Object is accessed via the keyword document. Recall from previous lectures: document.writeln() to print out to page. Document Object has: Collections Properties Methods 2
3 D oc um ent M ethods w rite() Writes HTML or JavaScript to a document w riteln() Same as write(), but adds a newline character Note that newline characters are normally ignored by browser. You can use the <pre> tag to preserve line breaks. Example: <pre> document.writeln( Hello ); document.writeln( World ); document.write( Hello ); document.write( World ); </pre> 3
4 D oc um ent M ethods g ete lem entb yid() Accesses the first element with the specified id One can then access the various properties of this element innerhtml property refers to the text between the element s opening and closing tags 4 <head> <script type="text/javascript"> function getvalue() { var x=document.getelementbyid("myheader"); alert(x.innerhtml); } </script> </head> <body> <h1 id="myheader" onclick="getvalue()">click <em>me!</em></h1> </body> </html>
5 D oc um ent M ethods g ete lem ents B yn a m e() Accesses all elements with a specified name <head> <script type="text/javascript"> function calc() { var x=document.getelementsbyname("para"); alert("there are "+x.length+" paragraphs. First one says:"+x[0].innerhtml); } 5
6 D oc um ent M ethods g ete lem ents B yta g N a m e() Accesses all elements with a specified tagname <head> <script type="text/javascript"> function gettags() { var x=document.getelementsbytagname("input"); alert("there are "+x.length+" inputs. First second has value: "+x[1].value); } </script> </head> <body> <input type="text"/><br /> <input type="text"/><br /> <input type="text"/><br /> <input type="button" onclick="gettags()" value="how many input elements?" /> </body> </html> 6
7 U nders ta nding E vent H a ndlers Event Action that occurs within a Web browser Event handler Statement that tells browsers what code to run in response to specified event Syntax to insert event handler as an attribute <element onevent="script"...>... 7
8 Java S c ript E vent H a ndlers 8 Many more. See text or
9 E vent: onkeydow n The user has pressed a key. Example: 9 <head> <script type="text/javascript"> function update(id) { var txt=document.getelementbyid(id).value; document.getelementbyid(id).value=txt.touppercase(); } </script> </head> <body> Type something: <input type="text" id="fname" onkeydown="update(this.id)" /> </body> </html> Why is the last character not uppercase? Character is not added to input text until key goes up. When key down, function is called to convert input text to upper case. Only when function returns and key is released, the last character is appended to input text (still lower case!).
10 E vent: onkeyup The user pressed a key and released it. Example: <head> <script type="text/javascript"> function update(id) { var txt=document.getelementbyid(id).value; document.getelementbyid(id).value=txt.touppercase(); } </script> </head> <body> Type something: <input type="text" id="fname" onkeyup="update(this.id)" /> </body> </html> Each character is made upper case on key going up. 10
11 E vent: onc ha ng e The content of the input field has changed. Example: <head> <script type="text/javascript"> function update(id) { var txt=document.getelementbyid(id).value; document.getelementbyid(id).value=txt.touppercase(); } </script> </head> <body> Type something: <input type="text" id="fname" onchange="update(this.id)" /> </body> </html> No change to characters as you type. Event onchange is triggered only when you hit Enter key. 11
12 E vent: onc lic k User has clicked mouse button. Example: <head> <script type="text/javascript"> function calc() { var num1 = parseint(document.getelementbyid('num1').value); document.getelementbyid('num2').value = num1*num1; } </script> </head> <body> Enter a number: <input type="text" id="num1" /> <button onclick="calc()">click to square it</button> <input type="text" id="num2" readonly="true" /> </body> </html> 12
13 D ate O bjec t Allows your JavaScript to work with dates and times. There are 4 ways to create a Date object: Date Object with current date and time: <body> <script type="text/javascript"> var dt=new Date(); document.write(dt); 13 </script>
14 D ate Initia lis e U s ing S tring variable = new Date("month day, year hours:minutes:seconds"); 14 <body> <script type="text/javascript"> var dt=new Date("June 1, :11:00"); document.write(dt); </script> </body> </html>
15 D ate Initia lis ed U s ing N um ber var dt = new Date(num) num is number of ms past 01 Jan 01, :00:00 UTC Perth is UTC+08:00:00 There are 86,400,000 ms in one day <body> <script type="text/javascript"> var dt=new Date( ); document.write(dt); </script> </body> </html> 15
16 D ate Initia lis ed U s ing S evera l Pa ra m eters new Date(yr, mth, day, hrs, mins, secs, ms) Parameters are numbers and optional. If you leave out a parameter, zero will be assumed and all subsequent parameters must be left out also. new Date(2010) is valid. new Date(2010,, 1) is invalid. <body> <script type="text/javascript"> var dt=new Date(2010,0,1,2); document.write(dt); </script> </body> </html> 16
17 E xtra c ting D ate a nd Tim e Va lues 17
18 S etting D ate a nd Tim e Va lues 18
19 C reating a C us tom D ate Func tion showd ate() function returns dd/mm/yyyy formatted date. <head> <script type="text/javascript"> function showd ate(dateobj) { var thisdate = dateobj.getdate(); //get day var this Month = dateobj.getmonth()+1; //get month (jan=0 s o add 1) var this Year = dateo bj.getfullyear(); return thismonth + "/" + thisdate + "/" + thisyear; //get year //format as dd/mm/yyyy } </script> 19 </head>
20 C reating a C us tom Tim e Func tion showtime() function returns hh:mm:ss formated time. <head> <script type="text/javascript"> function showtime(dateo bj) { thiss econd=dateo bj.gets econds(); var this Minute=dateO bj.getminutes(); var this Hour=dateO bj.gethours(); return thishour + ":" + thisminute + ":" + thiss econd; //get seconds //get minutes //get hours //format as hh:mm:ss } </script> 20 </head>
21 C a lc ulate D a ys to N ew Yea r calcd ays() function returns number days to new year. <head> <script type="text/javascript"> function calcd ays(dateo bj) { var nextyear=dateobj.getfullyear()+1; var newyear=new D ate(nextyear,0,1); var ms = newyear-dateobj; var days = ms /(1000*60*60*24); //get next year //create date of next new year //calc ms from now to new year //convert ms to days return days; } 21 </script> We want integer whole days. How to rid of decimals?
22 C a lc ulate D a ys to N ew Yea r C ont calcd ays() function returns number days to new year. <head> <script type="text/javascript"> function calcd ays(dateo bj) { var nextyear=dateobj.getfullyear()+1; var newyear=new D ate(nextyear,0,1); var ms = newyear-dateobj; var days = ms /(1000*60*60*24); //get next year //create date of next new year //calc ms from now to new year //convert ms to days return days; } 22 </script>
23 Tim e to N ew Yea r Time to New Year can be expressed in number of days, hours, minutes and seconds. calcdays() returns a number. Integer portion is number whole days to new year. Decimal portion can be converted to remainder hours, mins and secs. calchours() returns remainder hours calcmins() returns remainder minutes calcsecs() returns remainder seconds 23
24 c a lc H ours () rem a inder hours to N ew Yea r <head> <s cript type="text/javascript"> function calchours(days) { var fracd ay = days - Math.floor(days); var hours = fracday*24; // get fractional day // convert to hours return hours; 24 } </s cript> </head> <body> <pre>
25 c a lc M ins () rem a inder m inutes to N ew Yea r <head> <s cript type="text/javascript"> function calcmins(hours) { var frachours = hours - Math.floor(hours); var minutes = frachours*60; // get fractional hours // convert to minutes return minutes; 25 } </s cript> </head> <body> <pre>
26 c a lc S ec s () rem a inder s ec onds to N ew Yea r <head> <s cript type="text/javascript"> function calcs ecs(minutes) { var fracmins = minutes - Math.floor(minutes); var seconds = fracmins*60; // get fractional minutes // convert to seconds return s econds; 26 } </s cript> </head> <body> <pre>
27 A utom atic a lly U pdating C ountdow n Use JavaScript timing events id = settimeout("command", delay) execute code sometime in future cleartimeout(id) cancels settimeout() 27
28 s ettim eout E xa m ple <head> <script type="text/javascript"> var c=1000; function start() { document.getelementbyid('num').value=c; c--; settimeout("start()",1000); } </script> 28 </head>
29 C reating the monthname A rra y 29
30 C reating the writedaynames() Func tion 30
31 T he C om plete daysinmonth() Func tion 31
32 R unning Java S c ript C om m a nds a s Links Syntax <a href="javascript:script">content</a> The following code runs the calctotal() function <a href="javascript:calctotal()"> </a> C alculate total cost 32
Place User-Defined Functions in the HEAD Section
JavaScript Functions Notes (Modified from: w3schools.com) A function is a block of code that will be executed when "someone" calls it. In JavaScript, we can define our own functions, called user-defined
More informationFull file at https://fratstock.eu Tutorial 2: Working with Operators and Expressions
Tutorial 2: Working with Operators and Expressions TRUE/FALSE 1. You can add a dynamic effect to a Web site using ontime processing. ANS: F PTS: 1 REF: JVS 54 2. You can not insert values into a Web form
More informationLECTURE-3. Exceptions JS Events. CS3101: Programming Languages: Javascript Ramana Isukapalli
LECTURE-3 Exceptions JS Events 1 EXCEPTIONS Syntax and usage Similar to Java/C++ exception handling try { // your code here catch (excptn) { // handle error // optional throw 2 EXCEPTIONS EXAMPLE
More informationWeb Programming and Design. MPT Junior Cycle Tutor: Tamara Demonstrators: Aaron, Marion, Hugh
Web Programming and Design MPT Junior Cycle Tutor: Tamara Demonstrators: Aaron, Marion, Hugh Plan for the next 5 weeks: Introduction to HTML tags, creating our template file Introduction to CSS and style
More informationLECTURE-2. Functions review HTML Forms. Arrays Exceptions Events. CS3101: Scripting Languages: Javascript Ramana Isukapalli
LECTURE-2 Functions review HTML Forms Arrays Exceptions Events 1 JAVASCRIPT FUNCTIONS, REVIEW Syntax function (params) { // code Note: Parameters do NOT have variable type. 1. Recall: Function
More informationJavascript Lecture 23
Javascript Lecture 23 Robb T. Koether Hampden-Sydney College Mar 9, 2012 Robb T. Koether (Hampden-Sydney College) JavascriptLecture 23 Mar 9, 2012 1 / 23 1 Javascript 2 The Document Object Model (DOM)
More informationCHAPTER 6 JAVASCRIPT PART 1
CHAPTER 6 JAVASCRIPT PART 1 1 OVERVIEW OF JAVASCRIPT JavaScript is an implementation of the ECMAScript language standard and is typically used to enable programmatic access to computational objects within
More informationCITS1231 Web Technologies. JavaScript
CITS1231 Web Technologies JavaScript Contents Introduction to JavaScript Variables Operators Conditional Statements Program Loops Popup Boxes Functions 2 User Interaction User interaction requires web
More informationWeb Programming/Scripting: JavaScript
CS 312 Internet Concepts Web Programming/Scripting: JavaScript Dr. Michele Weigle Department of Computer Science Old Dominion University mweigle@cs.odu.edu http://www.cs.odu.edu/~mweigle/cs312-f11/ 1 Outline!
More informationThe first sample. What is JavaScript?
Java Script Introduction JavaScript is the most popular scripting language on the internet, and works in all major browsers, such as Internet Explorer, Firefox, Chrome, Opera, and Safari. In this lecture
More informationCGS 3066: Spring 2015 JavaScript Reference
CGS 3066: Spring 2015 JavaScript Reference Can also be used as a study guide. Only covers topics discussed in class. 1 Introduction JavaScript is a scripting language produced by Netscape for use within
More informationJavaScript code is inserted between tags, just like normal HTML tags:
Introduction to JavaScript In this lesson we will provide a brief introduction to JavaScript. We won t go into a ton of detail. There are a number of good JavaScript tutorials on the web. What is JavaScript?
More informationIntroduction to DHTML
Introduction to DHTML HTML is based on thinking of a web page like a printed page: a document that is rendered once and that is static once rendered. The idea behind Dynamic HTML (DHTML), however, is to
More informationCISH-6510 Web Application Design and Development. Overview of JavaScript. Overview
CISH-6510 Web Application Design and Development Overview of JavaScript Overview What is JavaScript? History Uses of JavaScript Location of Code Simple Alert Example Events Events Example Color Example
More informationSoftware. Programming Languages. Types of Software. Types of Languages. Types of Programming. Software does something
Software Software does something LBSC 690: Week 10 Programming, JavaScript Jimmy Lin College of Information Studies University of Maryland Monday, April 9, 2007 Tells the machine how to operate on some
More informationSession 16. JavaScript Part 1. Reading
Session 16 JavaScript Part 1 1 Reading Reading Wikipedia en.wikipedia.org/wiki/javascript / p W3C www.w3.org/tr/rec-html40/interact/scripts.html Web Developers Notes www.webdevelopersnotes.com/tutorials/javascript/
More informationWorking with JavaScript
Working with JavaScript Creating a Programmable Web Page for North Pole Novelties 1 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page 2 Objectives
More informationWeb Engineering (Lecture 06) JavaScript part 2
Web Engineering (Lecture 06) JavaScript part 2 By: Mr. Sadiq Shah Lecturer (CS) Class BS(IT)-6 th semester JavaScript Events HTML events are "things" that happen to HTML elements. javascript lets you execute
More informationHTML 5 and CSS 3, Illustrated Complete. Unit L: Programming Web Pages with JavaScript
HTML 5 and CSS 3, Illustrated Complete Unit L: Programming Web Pages with JavaScript Objectives Explore the Document Object Model Add content using a script Trigger a script using an event handler Create
More informationCS 110 Exam 2 Spring 2011
CS 110 Exam 2 Spring 2011 Name (print): Integrity: By taking this exam, you pledge that this is your work and you have neither given nor received inappropriate help during the taking of this exam in compliance
More informationC HAPTER S EVEN F OCUS ON J AVAS CRIPT AND VBSCRIPT E XTENSIONS
C HAPTER S EVEN F OCUS ON J AVAS CRIPT AND VBSCRIPT E XTENSIONS Among the more creative and interesting ways to enhance the Web store is through advanced HTML tags. Today, among the most advanced of these
More informationIS 242 Web Application Development I
IS 242 Web Application Development I Lecture 11: Introduction to JavaScript (Part 4) Marwah Alaofi Outlines of today s lecture Events Assigning events using DOM Dom nodes Browser Object Model (BOM) 2 Event
More informationQ1. What is JavaScript?
Q1. What is JavaScript? JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting language A scripting language is a lightweight programming language JavaScript is usually embedded
More informationSession 6. JavaScript Part 1. Reading
Session 6 JavaScript Part 1 Reading Reading Wikipedia en.wikipedia.org/wiki/javascript Web Developers Notes www.webdevelopersnotes.com/tutorials/javascript/ JavaScript Debugging www.w3schools.com/js/js_debugging.asp
More informationClient vs Server Scripting
Client vs Server Scripting PHP is a server side scripting method. Why might server side scripting not be a good idea? What is a solution? We could try having the user download scripts that run on their
More informationBy the end of this section of the practical, the students should be able to:
By the end of this section of the practical, the students should be able to: Write JavaScript to generate HTML Create simple scripts which include input and output statements, arithmetic, relational and
More informationIntroduction to JavaScript
127 Lesson 14 Introduction to JavaScript Aim Objectives : To provide an introduction about JavaScript : To give an idea about, What is JavaScript? How to create a simple JavaScript? More about Java Script
More informationChapter 3 - Simple JavaScript - Programming Basics. Lesson 1 - JavaScript: What is it and what does it look like?
Chapter 3 - Simple JavaScript - Programming Basics Lesson 1 - JavaScript: What is it and what does it look like? PP presentation JavaScript.ppt. Lab 3.1. Lesson 2 - JavaScript Comments, document.write(),
More informationT his article is downloaded from
If you have a form and want to get the value of an input box, you need to use the val() function. Normal text and html function will not work here. The following example gets the text a user has entered
More informationFor loops and Window Objects:
For loops and Window Objects: So far we ve been dealing with the document object. The document object has many properties all elements within the html document are part of the document object. Thus we
More informationCOMS W3101: SCRIPTING LANGUAGES: JAVASCRIPT (FALL 2017)
COMS W3101: SCRIPTING LANGUAGES: JAVASCRIPT (FALL 2017) RAMANA ISUKAPALLI RAMANA@CS.COLUMBIA.EDU 1 LECTURE-1 Course overview See http://www.cs.columbia.edu/~ramana Overview of HTML Formatting, headings,
More informationPES DEGREE COLLEGE BANGALORE SOUTH CAMPUS 1 K.M. before Electronic City, Bangalore WEB PROGRAMMING Solution Set II
PES DEGREE COLLEGE BANGALORE SOUTH CAMPUS 1 K.M. before Electronic City, Bangalore 560 100 WEB PROGRAMMING Solution Set II Section A 1. This function evaluates a string as javascript statement or expression
More informationProduced by. App Development & Modeling. BSc in Applied Computing. Eamonn de Leastar
App Development & Modeling BSc in Applied Computing Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology http://www.wit.ie http://elearning.wit.ie
More informationJavaScript Introduction
JavaScript Introduction Web Technologies I. Zsolt Tóth University of Miskolc 2016 Zsolt Tóth (UM) JavaScript Introduction 2016 1 / 31 Introduction Table of Contents 1 Introduction 2 Syntax Variables Control
More informationINFS 2150 Introduction to Web Development and e-commerce Technology. Programming with JavaScript
INFS 2150 Introduction to Web Development and e-commerce Technology Programming with JavaScript 1 Objectives JavaScript client-side programming Example of a JavaScript program The element
More informationObjectives. Introduction to JavaScript. Introduction to JavaScript INFS Peter Y. Wu, RMU 1
Objectives INFS 2150 Introduction to Web Development and e-commerce Technology Programming with JavaScript JavaScript client-side programming Example of a JavaScript program The element
More informationCOMS 469: Interactive Media II
COMS 469: Interactive Media II Agenda Review Ch. 5: JavaScript An Object-Based Language Ch. 6: Programming the Browser Review Data Types & Variables Data Types Numeric String Boolean Variables Declaring
More informationJavascript. A key was pressed OR released. A key was released. A mouse button was pressed.
Javascript A script is a small piece of program that can add interactivity to the website. For example, a script could generate a pop-up alert box message, or provide a dropdown menu. This script could
More informationINTRODUCTION TO JAVASCRIPT
INTRODUCTION TO JAVASCRIPT Overview This course is designed to accommodate website designers who have some experience in building web pages. Lessons familiarize students with the ins and outs of basic
More informationCSC Web Programming. Introduction to JavaScript
CSC 242 - Web Programming Introduction to JavaScript JavaScript JavaScript is a client-side scripting language the code is executed by the web browser JavaScript is an embedded language it relies on its
More informationJavaScript Introduction
JavaScript Introduction What is JavaScript? JavaScript was designed to add interactivity to HTML pages JavaScript is usually embedded directly into HTML pages JavaScript is an interpreted language (means
More informationY oung W on Lim 9 /1 /1 7
Overview (1 A) Cop y rig h t (c) 2 0 0 9-2 0 1 7 Y oung W. Lim. Perm ission is g ra nted to cop y, d istribute a nd /or m od ify th is d ocum ent und er th e term s of th e G N UFree D ocum enta tion License,
More informationJavaScript by Vetri. Creating a Programmable Web Page
XP JavaScript by Vetri Creating a Programmable Web Page 1 XP Tutorial Objectives o Understand basic JavaScript syntax o Create an embedded and external script o Work with variables and data o Work with
More informationPrincess Nourah bint Abdulrahman University. Computer Sciences Department
Princess Nourah bint Abdulrahman University 1 And use http://www.w3schools.com/ JavaScript Objectives Introduction to JavaScript Objects Data Variables Operators Types Functions Events 4 Why Study JavaScript?
More informationA.A. 2008/09. Why introduce JavaScript. G. Cecchetti Internet Software Technologies
Internet t Software Technologies JavaScript part one IMCNE A.A. 2008/09 Gabriele Cecchetti Why introduce JavaScript To add dynamicity and interactivity to HTML pages 2 What s a script It s a little interpreted
More information3 The Building Blocks: Data Types, Literals, and Variables
chapter 3 The Building Blocks: Data Types, Literals, and Variables 3.1 Data Types A program can do many things, including calculations, sorting names, preparing phone lists, displaying images, validating
More informationwrite vs. writeln Prompting as Page Loads Today s Goals CSCI 2910 Client/Server-Side Programming Intermediate File vs. HTML Output
CSCI 2910 Client/Server-Side Programming Topic: JavaScript Part 2 Today s Goals Today s lecture will cover: More objects, properties, and methods of the DOM The Math object Introduction to form validation
More informationEnhancing Web Pages with JavaScript
Enhancing Web Pages with JavaScript Introduction In this Tour we will cover: o The basic concepts of programming o How those concepts are translated into JavaScript o How JavaScript can be used to enhance
More informationEVENT-DRIVEN PROGRAMMING
LESSON 13 EVENT-DRIVEN PROGRAMMING This lesson shows how to package JavaScript code into self-defined functions. The code in a function is not executed until the function is called upon by name. This is
More informationThen there are methods ; each method describes an action that can be done to (or with) the object.
When the browser loads a page, it stores it in an electronic form that programmers can then access through something known as an interface. The interface is a little like a predefined set of questions
More informationUnit Notes. ICAWEB411A Produce basic client-side script for dynamic web pages Topic 1 Introduction to JavaScript
Unit Notes ICAWEB411A Produce basic client-side script for dynamic web pages Topic 1 Introduction to JavaScript Copyright, 2013 by TAFE NSW - North Coast Institute Date last saved: 18 September 2013 by
More informationJavaScript. What s wrong with JavaScript?
JavaScript 1 What s wrong with JavaScript? A very powerful language, yet Often hated Browser inconsistencies Misunderstood Developers find it painful Lagging tool support Bad name for a language! Java
More informationJAVASCRIPT HTML DOM. The HTML DOM Tree of Objects. JavaScript HTML DOM 1/14
JAVASCRIPT HTML DOM The HTML DOM Tree of Objects JavaScript HTML DOM 1/14 ALL ELEMENTS ARE OBJECTS JavaScript can change all the HTML elements in the page JavaScript can change all the HTML attributes
More informationCISC 1600 Lecture 2.4 Introduction to JavaScript
CISC 1600 Lecture 2.4 Introduction to JavaScript Topics: Javascript overview The DOM Variables and objects Selection and Repetition Functions A simple animation What is JavaScript? JavaScript is not Java
More informationLecture 14. Introduction to JavaScript. Mr. Mubashir Ali Lecturer (Dept. of Computer Science)
Lecture 14 Introduction to JavaScript Mr. Mubashir Ali Lecturer (Dept. of dr.mubashirali1@gmail.com 1 Outline What is JavaScript? Embedding JavaScript with HTML JavaScript conventions Variables in JavaScript
More informationChapter 9: Simple JavaScript
Chapter 9: Simple JavaScript Learning Outcomes: Identify the benefits and uses of JavaScript Identify the key components of the JavaScript language, including selection, iteration, variables, functions
More informationA Balanced Introduction to Computer Science, 3/E
A Balanced Introduction to Computer Science, 3/E David Reed, Creighton University 2011 Pearson Prentice Hall ISBN 978-0-13-216675-1 Chapter 4 JavaScript and Dynamic Web Pages 1 Static vs. Dynamic Pages
More informationT his article is downloaded from
Sliding Elements with jquery T hes e are another s et of effec ts that hide or s how elements - s lidedown() and s lideu p(), T his works in a s imilar manner to the hide() and show() effects, except that
More informationTask 1. Set up Coursework/Examination Weights
Lab02 Page 1 of 6 Lab 02 Student Mark Calculation HTML table button textbox JavaScript comments function parameter and argument variable naming Number().toFixed() Introduction In this lab you will create
More informationSuch JavaScript Very Wow
Such JavaScript Very Wow Lecture 9 CGS 3066 Fall 2016 October 20, 2016 JavaScript Numbers JavaScript numbers can be written with, or without decimals. Extra large or extra small numbers can be written
More informationLoops/Confirm Tutorial:
Loops/Confirm Tutorial: What you ve learned so far: 3 ways to call a function how to write a function how to send values into parameters in a function How to create an array (of pictures, of sentences,
More informationJAVASCRIPT. JavaScript is the programming language of HTML and the Web. JavaScript Java. JavaScript is interpreted by the browser.
JAVASCRIPT JavaScript is the programming language of HTML and the Web. JavaScript Java JavaScript is interpreted by the browser JavaScript 1/15 JS WHERE TO
More informationWeb Development & Design Foundations with HTML5, 8 th Edition Instructor Materials Chapter 14 Test Bank
Multiple Choice. Choose the best answer. 1. JavaScript can be described as: a. an object-oriented scripting language b. an easy form of Java c. a language created by Microsoft 2. Select the true statement
More informationJavascript. UNIVERSITY OF MASSACHUSETTS AMHERST CMPSCI 120 Fall 2010
Lecture 14 Javascript Announcements Project #2 New website Exam#2 No. Class Date Subject and Handout(s) 17 11/4/10 Examination Review Practice Exam PDF 18 11/9/10 Search, Safety, Security Slides PDF UMass
More informationCOMP1730/COMP6730 Programming for Scientists. Data: Values, types and expressions.
COMP1730/COMP6730 Programming for Scientists Data: Values, types and expressions. Lecture outline * Data and data types. * Expressions: computing values. * Variables: remembering values. What is data?
More informationLecture 2. The variable 'x' can store integers, characters, string, float, boolean.
In this lecture we will learn 1 Arrays 2 Expressions and Operators 3 Functions 4 If-else construct 5 Switch Construct 6 loop constructs For While do-while Lecture 2 More about data types As I told in my
More informationORB Education Quality Teaching Resources
JavaScript is one of the programming languages that make things happen in a web page. It is a fantastic way for students to get to grips with some of the basics of programming, whilst opening the door
More informationProgramming language components
Programming language components syntax: grammar rules for defining legal statements what's grammatically legal? how are things built up from smaller things? semantics: what things mean what do they compute?
More informationJavaScript By: A. Mousavi & P. Broomhead SERG, School of Engineering Design, Brunel University, UK
Programming for Digital Media EE1707 JavaScript By: A. Mousavi & P. Broomhead SERG, School of Engineering Design, Brunel University, UK 1 References and Sources 1. Javascript & JQuery: interactive front-end
More informationCOMS 469: Interactive Media II
COMS 469: Interactive Media II Agenda Review Data Types & Variables Decisions, Loops, and Functions Review gunkelweb.com/coms469 Review Basic Terminology Computer Languages Interpreted vs. Compiled Client
More informationBy the end of this section of the practical, the students should be able to:
By the end of this section of the practical, the students should be able to: Learn about the Document Object Model and the Document Object Model hierarchy Create and use the properties, methods and event
More informationWhat is Java Script? Writing to The HTML Document. What Can JavaScript do? CMPT 165: Java Script
What is Java Script? CMPT 165: Java Script Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University November 7, 2011 JavaScript was designed to add interactivity to HTML pages
More informationPIC 40A. Midterm 1 Review
PIC 40A Midterm 1 Review XHTML and HTML5 Know the structure of an XHTML/HTML5 document (head, body) and what goes in each section. Understand meta tags and be able to give an example of a meta tags. Know
More informationIN Development in Platform Ecosystems Lecture 2: HTML, CSS, JavaScript
IN5320 - Development in Platform Ecosystems Lecture 2: HTML, CSS, JavaScript 27th of August 2018 Department of Informatics, University of Oslo Magnus Li - magl@ifi.uio.no 1 Today s lecture 1. 2. 3. 4.
More informationjquery Tutorial for Beginners: Nothing But the Goods
jquery Tutorial for Beginners: Nothing But the Goods Not too long ago I wrote an article for Six Revisions called Getting Started with jquery that covered some important things (concept-wise) that beginning
More informationintrojs.notebook March 02, 2014
1 document.write() uses the write method to write on the document. It writes the literal Hello World! which is enclosed in quotes since it is a literal and then enclosed in the () of the write method.
More informationChapter 2 Working with Data Types and Operators
JavaScript, Fourth Edition 2-1 Chapter 2 Working with Data Types and Operators At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics
More informationJavaScript. Learn to program using your browser
JavaScript Learn to program using your browser 0 Motivation When human beings acquired language, we learned not just how to listen but how to speak. When human beings acquired language, we learned not
More informationControlled Assessment Task. Question 1 - Describe how this HTML code produces the form displayed in the browser.
Controlled Assessment Task Question 1 - Describe how this HTML code produces the form displayed in the browser. The form s code is displayed in the tags; this creates the object which is the visible
More informationLesson 1: Writing Your First JavaScript
JavaScript 101 1-1 Lesson 1: Writing Your First JavaScript OBJECTIVES: In this lesson you will be taught how to Use the tag Insert JavaScript code in a Web page Hide your JavaScript
More informationChapter 16. JavaScript 3: Functions Table of Contents
Chapter 16. JavaScript 3: Functions Table of Contents Objectives... 2 14.1 Introduction... 2 14.1.1 Introduction to JavaScript Functions... 2 14.1.2 Uses of Functions... 2 14.2 Using Functions... 2 14.2.1
More information1. Cascading Style Sheet and JavaScript
1. Cascading Style Sheet and JavaScript Cascading Style Sheet or CSS allows you to specify styles for visual element of the website. Styles specify the appearance of particular page element on the screen.
More informationCPA JS Tag. < Tracking Methodology and Examples > 2018/11/21
CPA JS Tag < Tracking Methodology and Examples > 2018/11/21 CPA: Java Script Tracking Flow LINE Corporation 2 CPA: Java Script Tracking Flow LINE Campaign Detail Page Clientʼs Landing Page Thank you Page
More informationException Handling. Sometimes when the computer tries to execute a statement something goes wrong:
Exception Handling Run-time errors The exception concept Throwing exceptions Handling exceptions Declaring exceptions Creating your own exception Ariel Shamir 1 Run-time Errors Sometimes when the computer
More informationTutorial 10: Programming with JavaScript
Tutorial 10: Programming with JavaScript College of Computing & Information Technology King Abdulaziz University CPCS-665 Internet Technology Objectives Learn the history of JavaScript Create a script
More informationCITS1231 Web Technologies
CITS1231 Web Technologies Client side id Form Validation using JavaScript Objectives Recall how to create forms on web pages Understand the need for client side validation Know how to reference form elements
More informationprintf( Please enter another number: ); scanf( %d, &num2);
CIT 593 Intro to Computer Systems Lecture #13 (11/1/12) Now that we've looked at how an assembly language program runs on a computer, we're ready to move up a level and start working with more powerful
More informationException Handling. Run-time Errors. Methods Failure. Sometimes when the computer tries to execute a statement something goes wrong:
Exception Handling Run-time errors The exception concept Throwing exceptions Handling exceptions Declaring exceptions Creating your own exception 22 November 2007 Ariel Shamir 1 Run-time Errors Sometimes
More information(Refer Slide Time: 01:40)
Internet Technology Prof. Indranil Sengupta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture No #25 Javascript Part I Today will be talking about a language
More informationPHP Personal Home Page PHP: Hypertext Preprocessor (Lecture 35-37)
PHP Personal Home Page PHP: Hypertext Preprocessor (Lecture 35-37) A Server-side Scripting Programming Language An Introduction What is PHP? PHP stands for PHP: Hypertext Preprocessor. It is a server-side
More informationINTRODUCTION TO WEB DEVELOPMENT AND HTML. Lecture 15: JavaScript loops, Objects, Events - Spring 2011
INTRODUCTION TO WEB DEVELOPMENT AND HTML Lecture 15: JavaScript loops, Objects, Events - Spring 2011 Outline Selection Statements (if, if-else, switch) Loops (for, while, do..while) Built-in Objects: Strings
More informationJavaScript s role on the Web
Chris Panayiotou JavaScript s role on the Web JavaScript Programming Language Developed by Netscape for use in Navigator Web Browsers Purpose make web pages (documents) more dynamic and interactive Change
More informationPrograming for Digital Media EE1707. Lecture 3 JavaScript By: A. Mousavi and P. Broomhead SERG, School of Engineering Design, Brunel University, UK
Programing for Digital Media EE1707 Lecture 3 JavaScript By: A. Mousavi and P. Broomhead SERG, School of Engineering Design, Brunel University, UK 1 JavaScript Syntax Cont. 1. Conditional statements 2.
More informationProject 2: After Image
Project 2: After Image FIT100 Winter 2007 Have you ever stared at an image and noticed that when it disappeared, a shadow of the image was still briefly visible. This is called an after image, and we experiment
More informationA340 Laboratory Session #5
A340 Laboratory Session #5 LAB GOALS Creating multiplication table using JavaScript Creating Random numbers using the Math object Using your text editor (Notepad++ / TextWrangler) create a web page similar
More informationCOMP519 Practical 5 JavaScript (1)
COMP519 Practical 5 JavaScript (1) Introduction This worksheet contains exercises that are intended to familiarise you with JavaScript Programming. While you work through the tasks below compare your results
More informationManju Muralidharan Priya. CS4PM Web Aesthetics and Development WEEK 11
CS4PM Web Aesthetics and Development WEEK 11 Objective: Understand basics of JScript Outline: a. Basics of JScript Reading: Refer to w3schools websites and use the TRY IT YOURSELF editor and play with
More informationCSC Javascript
CSC 4800 Javascript See book! Javascript Syntax How to embed javascript between from an external file In an event handler URL - bookmarklet
More informationLike many institutions, University of Minnesota
ACRL TechConnect Janet Fransen, Megan Kocher, and Jody Kempf Google forms for staff self-assessment Creating customization Like many institutions, University of Minnesota recently adopted the Google Apps
More informationPeople = End Users & Programmers. The Web Browser Application. Program Design Phase. Algorithm Design -Mathematical Y = MX + B
The Web Browser Application People = End Users & Programmers Clients and Components Input from mouse and keyboard Controller HTTP Client FTP Client TCP/IP Network Interface HTML/XHTML CSS JavaScript Flash
More information