Lecture 6 Part a: JavaScript
|
|
- Buddy Ryan
- 6 years ago
- Views:
Transcription
1 Lecture 6 Part a: JavaScript G64HLL, High Level Languages Dr. Gabriela Ochoa gxo@cs.nott.ac.uk
2 Previous lecture Basics of java script The document, window objects The date and math objects How to display data and prompt input How to declare variables Conditionals and loops Arithmetic expressions G64HLL, Gabriela Ochoa 2
3 Today Object creation and modification Functions Arrays Constructors Pattern matching Several examples G64HLL, Gabriela Ochoa 3
4 Object creation and modification Objects can be created with new Use the Object constructor, as in var myobject = new Object(); The new object has no properties - a blank object Properties can be added to an object, any time var myairplane = new Object(); myairplane.make = "Cessna"; myairplane.model = "Centurian"; G64HLL, Gabriela Ochoa 4
5 Functions & Methods Software design: break software into modules (easier to maintain & debug) Modules JavaScript Functions Methods (belong to an object) JavaScript includes many useful pre-defined methods G64HLL, Gabriela Ochoa 5
6 Functions function function_name(parameter-list) { } -- declarations and statements Arguments separated by commas E.g. total += parsefloat( s1 + s2 ); We place all function definitions in the head of the XHTML document All variables that are either implicitly declared or explicitly declared outside functions are global Variables explicitly declared in a function are local G64HLL, Gabriela Ochoa 6
7 Function definitions return statement Can return either nothing, or a value return expression; No return statement same as return; Not returning a value when expected is an error G64HLL, Gabriela Ochoa 7
8 1 <?xml version = "1.0"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 3 " 4 5 <!-- Fig. 10.2: SquareInt.html --> 6 <!-- Square function --> 7 8 <html xmlns = " 9 <head> 10 <title>a Programmer-Defined square Function</title> <script type = "text/javascript"> 13 <!-- 14 document.writeln( 15 "<h1>square the numbers from 1 to 10</h1>" ); // square the numbers from 1 to for ( var x = 1; x <= 10; ++x ) 19 document.writeln( "The square of " + x + " is " + 20 square( x ) + "<br />" ); 21 SquareInt.html Square two numbers loop from 1 to 10 pass each argument to square Calling functionsquare and passing it the value ofx.
9 22 // The following square function's body is executed 23 // only when the function is explicitly called // square function definition Variableygets the value of variablex. SquareInt.html 26 function square( y ) 27 { 28 return y * y; 29 } 30 // --> 31 </script> 32 Thereturn statement passes the value ofy*y back to the calling function. 33 </head><body></body> 34 </html> return value of argument multiplied by itself display result
10 1 <?xml version = "1.0"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 3 " 4 5 <!-- Fig. 10.3: maximum.html --> 6 <!-- Maximum function --> 7 8 <html xmlns = " 9 <head> 10 <title>finding the Maximum of Three Values</title> <script type = "text/javascript"> 13 <!-- 14 var input1 = 15 window.prompt( "Enter first number", "0" ); 16 var input2 = 17 window.prompt( "Enter second number", "0" ); 18 var input3 = 19 window.prompt( "Enter third number", "0" ); var value1 = parsefloat( input1 ); 22 var value2 = parsefloat( input2 ); 23 var value3 = parsefloat( input3 ); Prompt for the user to input three integers. Finding the maximum of 3 numbers Prompt for 3 inputs Convert to numbers Pass to maximum Math.max
11 24 25 var maxvalue = maximum( value1, value2, value3 ); document.writeln( "First number: " + value "<br />Second number: " + value "<br />Third number: " + value "<br />Maximum is: " + maxvalue ); // maximum method definition (called from line 25) 33 function maximum( x, y, z ) 34 { 35 return Math.max( x, Math.max( y, z ) ); 36 } 37 // --> 38 </script> </head> 41 <body> 42 <p>click Refresh (or Reload) to run the script again</p> 43 </body> 44 </html> Call functionmaximum and pass it the value of variablesvalue1,value2 andvalue3. Methodmax returns the larger of the two integers passed to it. Variablesx,yandzget the value of variables value1,value2 andvalue3, respectively.
12 Arrays Data structures of related items (collections) Dynamic, they grow dynamically Start at zero element Arrays have a length property Operator new Allocates memory for objects Dynamic memory allocation operator var c; c = new Array( 12 ); G64HLL, Gabriela Ochoa 12
13 Arrays Length is dynamic - the length property stores the length Array objects can be created in two ways, with new, or by assigning an array literal var mylist = new Array(24, "bread", true); var mylist2 = [24, "bread", true]; var mylist3 = new Array(24); Because the length property is writeable, you can set it to make the array any length you like, as in mylist.length = 150; SHOW insert_names.js G64HLL, Gabriela Ochoa 13
14 Arrays Name of array Position number (index or subscript) of the element within arrayc c[ 0 ] c[ 1 ] c[ 2 ] c[ 3 ] c[ 4 ] c[ 5 ] c[ 6 ] c[ 7 ] c[ 8 ] c[ 9 ] c[ 10 ] c[ 11 ] Fig A 12-element array.
15 1 <?xml version = "1.0"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 3 " 4 5 <!-- Fig. 11.3: InitArray.html --> 6 <!-- Initializing an Array --> 7 8 <html xmlns = " 9 <head> 10 <title>initializing an Array</title> <script type = "text/javascript"> 13 <!-- 14 // this function is called when the <body> element's 15 // onload event occurs 16 function initializearrays() 17 { 18 var n1 = new Array( 5 ); // allocate 5-element Array 19 var n2 = new Array(); // allocate empty Array // assign values to each element of Array n1 22 for ( var i = 0; i < n1.length; ++i ) 23 n1[ i ] = i; Arrayn1 has five elements. Arrayn2 is an empty array. Thefor loop initializes the elements inn1 to their subscript numbers (0 to 4).
16 24 25 // create and initialize five-elements in Array n2 26 for ( i = 0; i < 5; ++i ) 27 n2[ i ] = i; outputarray( "Array n1 contains", n1 ); 30 outputarray( "Array n2 contains", n2 ); 31 } // output "header" followed by a two-column table 34 // containing subscripts and elements of "thearray" 35 function outputarray( header, thearray ) 36 { 37 document.writeln( "<h2>" + header + "</h2>" ); 38 document.writeln( "<table border = \"1\" width =" + 39 "\"100%\">" ); 40 The second first time time functionouputarray is called, is called, variableheader variableheader gets thegets value theof Array value n1 Array contains n2 and contains variablethearray and variable gets the thearray value ofn1. gets the value ofn2. 41 document.writeln( "<thead><th width = \"100\"" + 42 "align = \"left\">subscript</th>" + 43 "<th align = \"left\">value</th></thead><tbody>" ); Thefor loop adds five Each elements function toarrayn2 displays theand initialize each element contents to its subscript of its respective number Array (0 to 4). in an XHTML table.
17 44 45 for ( var i = 0; i < thearray.length; i++ ) 46 document.writeln( "<tr><td>" + i + "</td><td>" + 47 thearray[ i ] + "</td></tr>" ); document.writeln( "</tbody></table>" ); 50 } 51 // --> 52 </script> </head><body onload = "initializearrays()"></body> 55 </html>
18 1 <?xml version = "1.0"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 3 " 4 5 <!-- Fig. 11.5: SumArray.html --> 6 <!-- Summing Elements of an Array --> 7 SumArray.html 8 <html xmlns = " 9 <head> (1 of 2) 10 <title>sum the Elements of an Array</title> <script type = "text/javascript"> 13 <!-- 14 function start() 15 { 16 var thearray = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; 17 var total1 = 0, total2 = 0; for ( var i = 0; i < thearray.length; i++ ) 20 total1 += thearray[ i ]; document.writeln( "Total using subscripts: " + total1 ); 23 Thefor loop sums the values contained in the 10- element integer array calledthearray.
19 24 for ( var element in thearray ) 25 total2 += thearray[ element ]; document.writeln( "<br />Total using for...in: " + 28 total2 ); 29 } 30 // --> 31 </script> </head><body onload = "start()"></body> 34 </html> Variableelement is assigned a subscript in the range of 0 up to, but not including, thearray.length.
20 Constructors Used to initialize objects, but actually create the properties function plane(newmake, newmodel, newyear){ this.make = newmake; this.model = newmodel; this.year = newyear; } myplane = new plane("cessna","centurnian", "1970"); Can also have method properties function displayplane() { document.write("make: ", this.make, "<br />"); document.write("model: ", this.model, "<br />"); document.write("year: ", this.year, "<br />"); } Now add the following to the constructor: this.display = displayplane;
21 Pattern Matching JavaScript provides two ways to do pattern matching: 1. Using RegExp objects 2. Using methods on String objects Simple patterns Two categories of characters in patterns: a. normal characters (match themselves) b. metacharacters (can have special meaningsin patterns--do not match themselves) \ ( ) [ ] { } ^ $ * +?. A metacharacter is treated as a normal character if it is backslashed period is a special metacharacter - it matches any character except newline
22 Pattern Matching (continued) search(pattern) Returns the position in the object string of the pattern (position is relative to zero); returns -1 if it fails var str = "Gluckenheimer"; var position = str.search(/n/); /* position is now 6 */ Character classes Put a sequence of characters in brackets, and it defines a set of characters, any one of which matches: [abcd] Dashes can be used to specify spans of characters in a class: A caret at the left end of a class definition means the opposite: [a-z] [^0-9] G64HLL, Gabriela Ochoa 22
23 Pattern Matching (continued) Character class abbreviations Abbr. Equiv. Pattern Matches \d [0-9] a digit \D [^0-9] not a digit \w [A-Za-z_0-9] a word character \W [^A-Za-z_0-9] not a word character \s [ \r\t\n\f] a whitespace character \S [^ \r\t\n\f] not a whitespace character Quantifiers in braces Quantifier {n} {m,} {m, n} Meaning exactly n repetitions at least m repetitions at least m but not more than n repetitions G64HLL, Gabriela Ochoa 23
24 Example (forms_check.html) Common uses of JavaScript: check the format of input from HTML forms This example shows: use of a simple function to check that an input has the correct format of a telephone number G64HLL, Gabriela Ochoa 24
Chapter 11 - JavaScript: Arrays
Chapter - JavaScript: Arrays 1 Outline.1 Introduction.2 Arrays.3 Declaring and Allocating Arrays. Examples Using Arrays.5 References and Reference Parameters.6 Passing Arrays to Functions. Sorting Arrays.8
More information4.1 Overview of JavaScript
4.1 Overview of JavaScript - Originally developed by Netscape by Brendan Eich, as LiveScript - Became a joint venture of Netscape and Sun in 1995, renamed JavaScript - Now standardized by the European
More informationJavaScript I VP R 1. Copyright 2006 Haim Levkowitz. Outline
JavaScript I VP R 1 Outline Goals and Objectives Introduction JavaScript and Java Embedding JavaScript in XHTML Variables Statements Expressions and Operators Control Structures Code Execution Input and
More informationJavaScript: Functions Pearson Education, Inc. All rights reserved.
1 9 JavaScript: Functions 2 Form ever follows function. Louis Sullivan E pluribus unum. (One composed of many.) Virgil O! call back yesterday, bid time return. William Shakespeare Call me Ishmael. Herman
More informationJAVASCRIPT LESSON 4: FUNCTIONS
JAVASCRIPT LESSON 4: FUNCTIONS 11.1 Introductio n Programs that solve realworld programs More complex than programs from previous chapters Best way to develop & maintain large program: Construct from small,
More information334 JavaScript/JScript: Functions Chapter 11. boss. worker1 worker2 worker3. Hierarchical boss function/worker function relationship.
. iw3htp_11.fm Page 334 Thursday, April 13, 2000 12:33 PM 334 JavaScript/JScript: Functions Chapter 11 11 JavaScript/JScript: Functions boss worker1 worker2 worker3 worker4 worker5 Fig. 11.1 Hierarchical
More informationJavaScript: Introduction to Scripting
iw3htp2.book Page 194 Wednesday, July 18, 2001 9:01 AM 7 JavaScript: Introduction to Scripting Objectives To be able to write simple JavaScript programs. To be able to use input and output statements.
More informationChapter 8 JavaScript/JScript: Introduction to Scripting 201
iw3htp_08.fm Page 201 Thursday, April 13, 2000 12:30 PM Chapter 8 JavaScript/JScript: Introduction to Scripting 201 8 JavaScript/JScript: Introduction to Scripting 1
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 informationJavaScript: Control Statements I Pearson Education, Inc. All rights reserved.
1 7 JavaScript: Control Statements I 2 Let s all move one place on. Lewis Carroll The wheel is come full circle. William Shakespeare How many apples fell on Newton s head before he took the hint! Robert
More informationJavaScript: Introductionto Scripting
6 Comment is free, but facts are sacred. C. P. Scott The creditor hath a better memory than the debtor. James Howell When faced with a decision, I always ask, What would be the most fun? Peggy Walker Equality,
More informationJavascript Lesson 3: Controlled Structures ANDREY KUTASH
Javascript Lesson 3: Controlled Structures ANDREY KUTASH 10.1 Introduction Before programming a script have a Thorough understanding of problem Carefully planned approach to solve it When writing a script,
More informationChapter 9 - JavaScript: Control Structures II
Chapter 9 - JavaScript: Control Structures II Outline 9.1 Introduction 9.2 Essentials of Counter-Controlled Repetition 9.3 for Repetition Structure 9. Examples Using the for Structure 9.5 switch Multiple-Selection
More information(from Chapters 10/11 of the text)
IT350 Web and Internet Programming SlideSet #10: JavaScript Arrays and Objects (from Chapters 10/11 of the text) Everything you ever wanted to know about arrays function initializearrays() var n1 = new
More informationChapter 10 JavaScript/JScript: Control Structures II 289
IW3HTP_10.fm Page 289 Thursday, April 13, 2000 12:32 PM Chapter 10 JavaScript/JScript: Control Structures II 289 10 JavaScript/JScript: Control Structures II 1
More informationJavaScript: Control Statements I
7 JavaScript: Control Statements I OBJECTIVES In this chapter you will learn: Basic problem-solving techniques. To develop algorithms through the process of top-down, stepwise refinement. To use the if
More informationProject 3 CIS 408 Internet Computing
Problem 1: Project 3 CIS 408 Internet Computing Simple Table Template Processing with Java Script and DOM This project has you run code in your browser. Create a file TableTemplate.js that implements a
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 informationIT350 Web and Internet Programming Fall 2007 SlideSet #10: JavaScript Arrays, Objects, & Cookies. (from Chapter 11/12 of the text)
IT350 Web and Internet Programming Fall 2007 SlideSet #10: JavaScript Arrays, Objects, & Cookies (from Chapter 11/12 of the text) Everything you ever wanted to know about arrays function initializearrays()
More information(from Chapter 10/11 of the text)
IT350 Web and Internet Programming Fall 2008 SlideSet #9: JavaScript Arrays, Objects, & Cookies (from Chapter 10/11 of the text) Everything you ever wanted to know about arrays function initializearrays()
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 informationRegular Expressions. Regular expressions are a powerful search-and-replace technique that is widely used in other environments (such as Unix and Perl)
Regular Expressions Regular expressions are a powerful search-and-replace technique that is widely used in other environments (such as Unix and Perl) JavaScript started supporting regular expressions in
More informationProgram Design Phase. Algorithm Design - Mathematical. Algorithm Design - Sequence. Verify Algorithm Y = MX + B
Program Design Phase Write Program Specifications Analysis of requirements Program specifications description Describe what the goals of the program Describe appearance of input and output Algorithm Design
More informationExercise 1: Basic HTML and JavaScript
Exercise 1: Basic HTML and JavaScript Question 1: Table Create HTML markup that produces the table as shown in Figure 1. Figure 1 Question 2: Spacing Spacing can be added using CellSpacing and CellPadding
More informationUNIT-III THE BASICS OF JAVASCRIPT
UNIT-III THE BASICS OF JAVASCRIPT 3.1 Overview of Javascript 3.1.1 Origins Javascript which was originally developed at Netscape by Brendan Eich, was initially named Mocha but soon after was renamed LiveScript.
More informationSchenker AB. Interface documentation Map integration
Schenker AB Interface documentation Map integration Index 1 General information... 1 1.1 Getting started...1 1.2 Authentication...1 2 Website Map... 2 2.1 Information...2 2.2 Methods...2 2.3 Parameters...2
More informationJavaScript Functions, Objects and Array
JavaScript Functions, Objects and Array Defining a Function A definition starts with the word function. A name follows that must start with a letter or underscore, followed by any number of letters, digits,
More informationHTML Summary. All of the following are containers. Structure. Italics Bold. Line Break. Horizontal Rule. Non-break (hard) space.
HTML Summary Structure All of the following are containers. Structure Contains the entire web page. Contains information
More informationIT350 Web and Internet Programming. XHTML Tables and Forms (from Chapter 4 of the text 4 th edition Chapter 2 of the text 5 th edition)
IT350 Web and Internet Programming XHTML Tables and Forms (from Chapter 4 of the text 4 th edition Chapter 2 of the text 5 th edition) 4.10 Tables 1 Table Basics table element border, summary, caption
More informationChapter 1 Introduction to Computers and the Internet
CPET 499/ITC 250 Web Systems Dec. 6, 2012 Review of Courses Chapter 1 Introduction to Computers and the Internet The Internet in Industry & Research o E Commerce & Business o Mobile Computing and SmartPhone
More informationCHAPTER 5: JavaScript Basics 99
CHAPTER 5: JavaScript Basics 99 5.2 JavaScript Keywords, Variables, and Operators 5.2.1 JavaScript Keywords break case continue default delete do else export false for function if import in new null return
More informationLecture 3: The Basics of JavaScript. Background. Needs for Programming Capability. Origin of JavaScript. Using Client-side JavaScript
Lecture 3: The Basics of JavaScript Wendy Liu CSC309F Fall 2007 Background Origin and facts 1 2 Needs for Programming Capability XHTML and CSS allows the browser to passively display static content How
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 informationPart A Short Answer (50 marks)
Part A Short Answer (50 marks) NOTE: Answers for Part A should be no more than 3-4 sentences long. 1. (5 marks) What is the purpose of HTML? What is the purpose of a DTD? How do HTML and DTDs relate to
More informationHistory of the Internet. The Internet - A Huge Virtual Network. Global Information Infrastructure. Client Server Network Connectivity
History of the Internet It is desired to have a single network Interconnect LANs using WAN Technology Access any computer on a LAN remotely via WAN technology Department of Defense sponsors research ARPA
More informationInternet publishing HTML (XHTML) language. Petr Zámostný room: A-72a phone.:
Internet publishing HTML (XHTML) language Petr Zámostný room: A-72a phone.: 4222 e-mail: petr.zamostny@vscht.cz Essential HTML components Element element example Start tag Element content End tag
More informationCITS1231 Web Technologies. JavaScript Math, String, Array, Number, Debugging
CITS1231 Web Technologies JavaScript Math, String, Array, Number, Debugging Last Lecture Introduction to JavaScript Variables Operators Conditional Statements Program Loops Popup Boxes Functions 3 This
More informationIntroduction to JavaScript p. 1 JavaScript Myths p. 2 Versions of JavaScript p. 2 Client-Side JavaScript p. 3 JavaScript in Other Contexts p.
Preface p. xiii 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 Client-Side JavaScript: Executable Content
More informationCSI 3140 WWW Structures, Techniques and Standards. Markup Languages: XHTML 1.0
CSI 3140 WWW Structures, Techniques and Standards Markup Languages: XHTML 1.0 HTML Hello World! Document Type Declaration Document Instance Guy-Vincent Jourdan :: CSI 3140 :: based on Jeffrey C. Jackson
More informationc122mar413.notebook March 06, 2013
These are the programs I am going to cover today. 1 2 Javascript is embedded in HTML. The document.write() will write the literal Hello World! to the web page document. Then the alert() puts out a pop
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 informationChapter 4 Basics of JavaScript
Chapter 4 Basics of JavaScript JavaScript/EcmaScript References The official EcmaScript, third edition, specification http://www.ecma-international.org/publications/files/ecma-st/ecma-262.pdf A working
More informationCHAPTER 2 MARKUP LANGUAGES: XHTML 1.0
WEB TECHNOLOGIES A COMPUTER SCIENCE PERSPECTIVE CHAPTER 2 MARKUP LANGUAGES: XHTML 1.0 Modified by Ahmed Sallam Based on original slides by Jeffrey C. Jackson reserved. 0-13-185603-0 HTML HELLO WORLD! Document
More informationJAVASCRIPT BASICS. Type-Conversion in JavaScript. Type conversion or typecasting is one of the very important concept in
Type-Conversion in JavaScript Description Type conversion or typecasting is one of the very important concept in JavaScript. It refers to changing an entity or variable from one datatype to another. There
More informationJavaScript: Introduction, Types
JavaScript: Introduction, Types Computer Science and Engineering College of Engineering The Ohio State University Lecture 19 History Developed by Netscape "LiveScript", then renamed "JavaScript" Nothing
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 informationClient-Side Web Technologies. JavaScript Part I
Client-Side Web Technologies JavaScript Part I JavaScript First appeared in 1996 in Netscape Navigator Main purpose was to handle input validation that was currently being done server-side Now a powerful
More informationUNIT -II. Language-History and Versions Introduction JavaScript in Perspective-
UNIT -II Style Sheets: CSS-Introduction to Cascading Style Sheets-Features- Core Syntax-Style Sheets and HTML Style Rle Cascading and Inheritance-Text Properties-Box Model Normal Flow Box Layout- Beyond
More informationC How to Program, 6/e by Pearson Education, Inc. All Rights Reserved.
C How to Program, 6/e 1992-2010 by Pearson Education, Inc. An important part of the solution to any problem is the presentation of the results. In this chapter, we discuss in depth the formatting features
More informationChapter 4. Introduction to XHTML: Part 1
Chapter 4. Introduction to XHTML: Part 1 XHTML is a markup language for identifying the elements of a page so a browser can render that page on a computer screen. Document presentation is generally separated
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 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 informationHyperText Markup Language (HTML)
HyperText Markup Language (HTML) Mendel Rosenblum 1 Web Application Architecture Web Browser Web Server / Application server Storage System HTTP Internet LAN 2 Browser environment is different Traditional
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 information12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.
Java How to Program, 9/e Education, Inc. All Rights Reserved. } Java application programming } Use tools from the JDK to compile and run programs. } Videos at www.deitel.com/books/jhtp9/ Help you get started
More informationTrabalhando com JavaServer Pages (JSP)
Trabalhando com JavaServer Pages (JSP) Sumário 7.2.1 Introdução 7.2.2 JavaServer Pages Overview 7.2.3 First JavaServer Page Example 7.2.4 Implicit Objects 7.2.5 Scripting 7.2.5.1 Scripting Components 7.2.5.2
More informationJavaScript CS 4640 Programming Languages for Web Applications
JavaScript CS 4640 Programming Languages for Web Applications 1 How HTML, CSS, and JS Fit Together {css} javascript() Content layer The HTML gives the page structure and adds semantics Presentation
More informationCS1520 Recitation Week 2
CS1520 Recitation Week 2 Javascript http://cs.pitt.edu/~jlee/teaching/cs1520 Jeongmin Lee, (jlee@cs.pitt.edu) Today - Review of Syntax - Embed code - Syntax - Declare variable - Numeric, String, Datetime
More information12/22/11. Java How to Program, 9/e. public must be stored in a file that has the same name as the class and ends with the.java file-name extension.
Java How to Program, 9/e Education, Inc. All Rights Reserved. } Covered in this chapter Classes Objects Methods Parameters double primitive type } Create a new class (GradeBook) } Use it to create an object.
More informationc) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance.
2.1 Introduction (No questions.) 2.2 A Simple Program: Printing a Line of Text 2.1 Which of the following must every C program have? (a) main (b) #include (c) /* (d) 2.2 Every statement in C
More informationDr. Sarah Abraham University of Texas at Austin Computer Science Department. Regular Expressions. Elements of Graphics CS324e Spring 2017
Dr. Sarah Abraham University of Texas at Austin Computer Science Department Regular Expressions Elements of Graphics CS324e Spring 2017 What are Regular Expressions? Describe a set of strings based on
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 informationJavaScript CS 4640 Programming Languages for Web Applications
JavaScript CS 4640 Programming Languages for Web Applications 1 How HTML, CSS, and JS Fit Together {css} javascript() Content layer The HTML gives the page structure and adds semantics Presentation
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 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 informationVisual C# 2012 How to Program by Pe ars on Ed uc ati on, Inc. All Ri ght s Re ser ve d.
Visual C# 2012 How to Program 1 99 2-20 14 by Pe ars on Ed uc ati on, Inc. All Ri ght s Re ser ve d. 1992-2014 by Pearson Education, Inc. All 1992-2014 by Pearson Education, Inc. All Although commonly
More informationDecaf Language Reference Manual
Decaf Language Reference Manual C. R. Ramakrishnan Department of Computer Science SUNY at Stony Brook Stony Brook, NY 11794-4400 cram@cs.stonybrook.edu February 12, 2012 Decaf is a small object oriented
More informationHTML5 and CSS3 More JavaScript Page 1
HTML5 and CSS3 More JavaScript Page 1 1 HTML5 and CSS3 MORE JAVASCRIPT 3 4 6 7 9 The Math Object The Math object lets the programmer perform built-in mathematical tasks Includes several mathematical methods
More informationCOMP519 Web Programming Lecture 11: JavaScript (Part 2) Handouts
COMP519 Web Programming Lecture 11: JavaScript (Part 2) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool
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 informationmap1.html 1/1 lectures/8/src/
map1.html 1/1 3: map1.html 5: Demonstrates a "hello, world" of maps. 7: Computer Science E-75 8: David J. Malan 9: 10: --> 1 13:
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 informationChapter 2:- Introduction to XHTML. Compiled By:- Sanjay Patel Assistant Professor, SVBIT.
Chapter 2:- Introduction to XHTML Compiled By:- Assistant Professor, SVBIT. Outline Introduction to XHTML Move to XHTML Meta tags Character entities Frames and frame sets Inside Browser What is XHTML?
More informationTitle: Dec 11 3:40 PM (1 of 11)
... basic iframe body {color: brown; font family: "Times New Roman"} this is a test of using iframe Here I have set up two iframes next to each
More informationChapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines.
Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of
More informationLecture 05 I/O statements Printf, Scanf Simple statements, Compound statements
Programming, Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 05 I/O statements Printf, Scanf Simple
More informationHTML HTML. Chris Seddon CRS Enterprises Ltd 1
Chris Seddon seddon-software@keme.co.uk 2000-12 CRS Enterprises Ltd 1 2000-12 CRS Enterprises Ltd 2 Reference Sites W3C W3C w3schools DevGuru Aptana GotAPI Dog http://www.w3.org/ http://www.w3schools.com
More informationPHP. Interactive Web Systems
PHP Interactive Web Systems PHP PHP is an open-source server side scripting language. PHP stands for PHP: Hypertext Preprocessor One of the most popular server side languages Second most popular on GitHub
More informationXHTML & CSS CASCADING STYLE SHEETS
CASCADING STYLE SHEETS What is XHTML? XHTML stands for Extensible Hypertext Markup Language XHTML is aimed to replace HTML XHTML is almost identical to HTML 4.01 XHTML is a stricter and cleaner version
More informationCS 230 Programming Languages
CS 230 Programming Languages 09 / 20 / 2013 Instructor: Michael Eckmann Today s Topics Questions/comments? Continue Regular expressions Matching string basics =~ (matches) m/ / (this is the format of match
More informationAnnouncements. Paper due this Wednesday
Announcements Paper due this Wednesday 1 Client and Server Client and server are two terms frequently used Client/Server Model Client/Server model when talking about software Client/Server model when talking
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 informationToday's Goals. CSCI 2910 Client/Server-Side Programming. Objects in PHP. Defining a Class. Creating a New PHP Object Instance
CSCI 2910 Client/Server-Side Programming Topic: More Topics in PHP Reading: Williams & Lane pp. 108 121 and 232 243 Today's Goals Today we will begin with a discussion on objects in PHP including how to
More informationID1354 Internet Applications
ID1354 Internet Applications JavaScript Leif Lindbäck, Nima Dokoohaki leifl@kth.se, nimad@kth.se SCS/ICT/KTH Overview of JavaScript Originally developed by Netscape, as LiveScript Became a joint venture
More informationPHP and MySQL for Dynamic Web Sites. Intro Ed Crowley
PHP and MySQL for Dynamic Web Sites Intro Ed Crowley Class Preparation If you haven t already, download the sample scripts from: http://www.larryullman.com/books/phpand-mysql-for-dynamic-web-sitesvisual-quickpro-guide-4thedition/#downloads
More informationJava How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved.
Java How to Program, 10/e Education, Inc. All Rights Reserved. Each class you create becomes a new type that can be used to declare variables and create objects. You can declare new classes as needed;
More informationIT350 Web & Internet Programming. Fall 2012
IT350 Web & Internet Programming Fall 2012 Asst. Prof. Adina Crăiniceanu http://www.usna.edu/users/cs/adina/teaching/it350/fall2012/ 2 Outline Class Survey / Role Call What is: - the web/internet? - web
More informationA A B U n i v e r s i t y
A A B U n i v e r s i t y Faculty of Computer Sciences O b j e c t O r i e n t e d P r o g r a m m i n g Week 4: Introduction to Classes and Objects Asst. Prof. Dr. M entor Hamiti mentor.hamiti@universitetiaab.com
More informationCS112 Lecture: Variables, Expressions, Computation, Constants, Numeric Input-Output
CS112 Lecture: Variables, Expressions, Computation, Constants, Numeric Input-Output Last revised January 12, 2006 Objectives: 1. To introduce arithmetic operators and expressions 2. To introduce variables
More informationJavaScript: The Basics
JavaScript: The Basics CISC 282 October 4, 2017 JavaScript A programming language "Lightweight" and versatile Not universally respected Appreciated in the web domain Adds programmatic functionality to
More informationBasics of JavaScript. Last Week. Needs for Programming Capability. Browser as Development Platform. Using Client-side JavaScript. Origin of JavaScript
Basics of JavaScript History of the Web XHTML CSS Last Week Nan Niu (nn@cs.toronto.edu) CSC309 -- Fall 2008 2 Needs for Programming Capability XHTML and CSS allows the browser to passively display static
More informationintroduction to XHTML
introduction to XHTML XHTML stands for Extensible HyperText Markup Language and is based on HTML 4.0, incorporating XML. Due to this fusion the mark up language will remain compatible with existing browsers
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 7: Javascript: Control Statements. Background and Terminology. Background and Terminology. Background and Terminology
Chapter 7: Javascript: Control Statements CS 80: Internet Programming Instructor: Mark Edmonds Background and Terminology Algorithm What is an algorithm? A procedure for solving a problem. Consists of:
More informationJava How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved.
Java How to Program, 10/e Copyright 1992-2015 by Pearson Education, Inc. All Rights Reserved. Data structures Collections of related data items. Discussed in depth in Chapters 16 21. Array objects Data
More informationCS112 Lecture: Working with Numbers
CS112 Lecture: Working with Numbers Last revised January 30, 2008 Objectives: 1. To introduce arithmetic operators and expressions 2. To expand on accessor methods 3. To expand on variables, declarations
More informationLecture 2: Tools & Concepts
Lecture 2: Tools & Concepts CMPSCI120 Editors WIN NotePad++ Mac Textwrangler 1 Secure Login Go WIN SecureCRT, PUTTY WinSCP Mac Terminal SFTP WIN WinSCP Mac Fugu 2 Intro to unix pipes & filters file system
More information710 Index Attributes, 127 action attribute, 263 assigning, bottom attribute, domain name attribute, 481 expiration date attribute, 480 8
INDEX Symbols = (assignment operator), 56 \ (backslash), 33 \b (backspace), 33 \" (double quotation mark), 32 \e (escape), 33 \f (form feed), 33
More informationAssoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.
Assoc. Prof. Dr. Marenglen Biba Laboratory Session: Exercises on classes Analogy to help you understand classes and their contents. Suppose you want to drive a car and make it go faster by pressing down
More informationUnit 20 - Client Side Customisation of Web Pages. Week 4 Lesson 5 Fundamentals of Scripting
Unit 20 - Client Side Customisation of Web Pages Week 4 Lesson 5 Fundamentals of Scripting The story so far... three methods of writing CSS: In-line Embedded }These are sometimes called External } block
More information