Dynamic Web Authoring JavaScript – Array and function (2) COM311H Zheng, School of C&M, UUJ1.

Slides:



Advertisements
Similar presentations
Chapter 7 JavaScript: Introduction to Scripting. Outline Simple Programs Objects and Variables Obtaining User Input with prompt Dialogs – –Dynamic Welcome.
Advertisements

1 What is JavaScript? JavaScript was designed to add interactivity to HTML pages JavaScript is a scripting language A scripting language is a lightweight.
Day 2 – JavaScript & PHP.  Have the hover effect display an extra image  Add an extra image for each of the tags  In your writeText() function, you.
COM311H Zheng, School of C&M, UUJ1 Dynamic Web Authoring JavaScript Basics (Array and Function)
The Web Warrior Guide to Web Design Technologies
1 Lesson 10 Using JavaScript with Styles HTML and JavaScript BASICS, 4 th Edition Barksdale / Turner.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic JavaScript: Introduction to Scripting.
Tutorial 10 Programming with JavaScript
CIS101 Introduction to Computing Week 10 Spring 2004.
CM143 - Web Week 2 Basic HTML. Links and Image Tags.
COS 125 DAY 15. Agenda Assignment 4 Posted –Due March 25 Assignment 5 posted –Due April 1 (no joke!) Left to do –5 Assignments (9 total) One per week.
CIS101 Introduction to Computing Week 10. Agenda Your questions Final exam and final project CIS101 Student Survey Class presentations: Your Mad Libs.
COS 125 DAY 15. Agenda Second Capstone Progress Report Due Mar 24 Assignment #4 assigned –Due Thursday, March 24 Exam #3 will be on March 24 –Castro Chaps.
(CS1301) Introduction to Computer Programming City Univ of HK / Dept of CS / Helena Wong 1. Overview of Programming and JavaScript - 1
Introduction to scripting
 2004 Prentice Hall, Inc. All rights reserved. Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
WEB DESIGN AND PROGRAMMING Introduction to Javascript.
Introduction to Programming the WWW I CMSC Summer 2003 Lecture 12.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Homework for October 2011 Nikolay Kostov Telerik Corporation
CSC318 – DYNAMIC WEB APPLICATION DEVELOPMENT
The Web Wizard’s Guide To JavaScript Chapter 6 Working with Dates and Times.
Dynamic Web Authoring Week3 – Javascript Basic COM311H Zheng, School of C&M, UUJ1.
HTML (continued). Assignment 3 Creating a web page with:  Images  Hyperlinks to some websites  Hyperlinks to your  Information about a company,
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
© 2010 Delmar, Cengage Learning Chapter 8 Collecting Data with Forms.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
Tutorial 10 Programming with JavaScript
CHAPTER 4 Java Script อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Intro to PHP IST2101. Review: HTML & Tags 2IST210.
PHP Form Introduction Getting User Information Text Input.
Input & Output Functions JavaScript is special from other languages because it can accept input and produce output on the basis of that input in the same.
Introduction to Programming JScript Six Scripting functions Discuss functions Password Example.
05 – Java Script (1) Informatics Department Parahyangan Catholic University.
HTML Basic. What is HTML HTML is a language for describing web pages. HTML stands for Hyper Text Markup Language HTML is not a programming language, it.
JavaScript. JavaScript is the programming language of HTML and the Web. Easy to learn One of the 3 languages of all developers MUST learn: 1. HTML to.
1 Chapter 3 – JavaScript Outline Introduction Flowcharts Control Structures if Selection Structure if/else Selection Structure while Repetition Structure.
HTML JAVASCRIPT. CONTENTS Javascript Example NOSCRIPT Tag Advantages Summary Exercise.
1 CSC160 Chapter 7: Events and Event Handlers. 2 Outline Event and event handlers onClick event handler onMouseOver event handler onMouseOut event handler.
Introduction into JavaScript Java 1 JavaScript JavaScript programs run from within an HTML document The statements that make up a program in an HTML.
HTML Overview Part 5 – JavaScript 1. Scripts 2  Scripts are used to add dynamic content to a web page.  Scripts consist of a list of commands that execute.
JavaScript Challenges Answers for challenges
Dynamic Web Authoring JavaScript – Looping statements COM311H Zheng, School of C&M, UUJ1.
Headings are defined with the to tags. defines the largest heading. defines the smallest heading. Note: Browsers automatically add an empty line before.
Project 6 Creating Forms on a Web Page. Objectives Define terms related to forms Describe the different form controls and their uses Use the tag Create.
 2003 Prentice Hall, Inc. All rights reserved. Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing a Line of Text in a Web Page 7.3 Another JavaScript.
JavaScript. JavaScript Introduction JavaScript is the world's most popular programming language. It is the language for HTML and the web, for servers,
Document Object Model Nasrullah. DOM When a page is loaded,browser creates a Document Object Model of the Page.
LESSON : EVENTS AND FORM VALIDATION -JAVASCRIPT. EVENTS CLICK.
JavaScript Events Java 4 Understanding Events Events add interactivity between the web page and the user You can think of an event as a trigger that.
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
CSC 121 Computers and Scientific Thinking Fall Event-Driven Programming.
JavaScript Events. Understanding Events Events add interactivity between the web page and the user Events add interactivity between the web page and the.
Chapter 5 Murach's JavaScript and jQuery, C1© 2012, Mike Murach & Associates, Inc.Slide 1.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
Basic HTML Page 1. First Open Windows Notepad to type your HTML code 2.
INTERNET APPLICATIONS CPIT405 JavaScript Instructor: Rasha AlOmari
Week-11 (Lecture-1) Introduction to HTML programming: A web based markup language for web. Ex.
 2001 Prentice Hall, Inc. All rights reserved. Outline 1 JavaScript.
Client-side (JavaScript) Validation. Associating a function with a click event – Part 1 Use the input tag’s onclick attribute to associate a function.
Dynamic Web Authoring form validation (1) COM311H Zheng, School of C&M, UUJ1.
Web Basics: HTML/CSS/JavaScript What are they?
© 2015, Mike Murach & Associates, Inc.
Intro to JavaScript CS 1150 Spring 2017.
We are starting to program with JavaScript
Web Programming Ben Blanc
The Web Wizard’s Guide To JavaScript
Presentation transcript:

Dynamic Web Authoring JavaScript – Array and function (2) COM311H Zheng, School of C&M, UUJ1

Teaching Plan Feedback on Week4 practical More on Array and function Week 5 practicals COM311 H Zheng, School of C&M, UUJ 2

Issues observed in Practical When using javascript function, make sure place it within the head section javascript library – plain text file, can take more than one function Don’t use copy&paste, type the code yourself Use only one block if possible Always use debugging tools!! Reading list is available on Blackboard COM311 H Zheng, School of C&M, UUJ 3

Access object values/properties from html form Using object names var visitorname = document.myform.visitor.value; Using element IDs var visitorname = document.getElementById( ' visitorid ' ).value; COM311 H Zheng, School of C&M, UUJ 4

Display results window.alert( ) => pop up alert window window.document.write( ) => open a new document and display the information document.getElementById(id).innerHTML = new HTML => change the content of an HTML element on the same page Hello World! (or: ) document.getElementById("p1").innerHTML = "New text!"; COM311 H Zheng, School of C&M, UUJ 5

Access other form objects - image In javascript: alertText =document.myform.photo.src; Window.alert(alertText); In html form ‘myform’: COM311 H Zheng, School of C&M, UUJ 6

Access other form objects - checkbox In html form ‘myform’: Mobile Post Visit In javascript: Window.alert(document.myform.contact[0].value); COM311 H Zheng, School of C&M, UUJ 7

Access to form element – selection menu In html form ‘myform’: QUB Ulster In javascript: var myUniID = document.myform.Uni; var myUni = myUniID.options[myUniID.selectedIndex].value; COM311 H Zheng, School of C&M, UUJ 8

Assign a value to html element/object using javascript window.document.myform.visitor.value = ''John''; document.getElementById('visitorID').inn erHTML=''John"; COM311 H Zheng, School of C&M, UUJ 9

Using html in javascript html tags can be used in Javascript code by placing them with double quotes using window.document.write( ): window.document.write('' ''); window.document.write('' This is a test. ''); COM311 H Zheng, School of C&M, UUJ 10

Function function add(a, b) { return a + b; } Call function: var sum = add(2, 2); COM311 H Zheng, School of C&M, UUJ 11

Function function add(a, b) { return a + b; } function add3(a,b,c){ var addtwo = add(a,b); var result= add(addtwo, c); return result; } COM311 H Zheng, School of C&M, UUJ 12

exercise Write a function that calculates average of two exam marks. COM311 H Zheng, School of C&M, UUJ 13

practical Create an online calculator that calculates two numbers that user input and display the result. Input value to the form text field is string type To convert a string to a number, you can use parseFloat() or parseInt() method. var number = “32”; parseInt(number); COM311 H Zheng, School of C&M, UUJ 14