Javascript Tools Document Object Model Problem Modeling & Solution Interaction Diagram Javascript Example quizzer06.html under Javascript-Examples > JavaScript-DOM.

Slides:



Advertisements
Similar presentations
JavaScript Chapter 6 Note new scoring. spin.js (page 67) function spin() function spin() { var obj_style = document.getElementById("d1").style; var obj_style.
Advertisements

Northwestern University Business Intelligence Solutions Cognos 8 Best Practices Volume 3 Advanced Developer Techniques.
LING 408/508: Programming for Linguists Lecture 12 October 2 nd.
Javascript Introduction Norman White Material is from w3schools.com Go there to run examples interactively.
1 Programmer-Defined Functions Functions allow program modularization Variables declared in function are local variables Only known inside function in.
1 A Balanced Introduction to Computer Science, 2/E David Reed, Creighton University ©2008 Pearson Prentice Hall ISBN Chapter 7 Event-Driven.
HTML Markup language - controls appearance & content of a document Javascripts HTML tags trigger function execution events.
Information Technology Center Hany Abdelwahab Computer Specialist.
JavaScript Lesson 1 TBE 540. Prerequisites  Before beginning this lesson, the learner must be able to… Create a basic web page using a text editor and/or.
JavaScript “Hello World” in Microsoft Visual Studio August 2012.
JavaScript onLoad getElement. onload Using JavaScript to create content No user input Comes up when page LOADS [redo Koozebane; random picture]
Lesson 8 Creating Forms with JavaScript
JavaScript Programming Basics Chapter What is Programming?
Prime Factorization.
Web Programming – Java Script Association of Computing Activities Computer Science and Engineering Indian Institute of Technology Kanpur.
JS: DOM Form Form Object Form Object –The Form object represents an HTML form. –For each instance of a tag in an HTML document, a Form object is created.
XForms: A case study Rajiv Shivane & Pavitar Singh.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
JavaScript: Functions © by Pearson Education, Inc. All Rights Reserved.
Jasmine Testing Framework. What’s Jasmine For? Framework for Test Driven Development Designed around acceptance testing Works in any environment (with.
JavaScript, Fourth Edition
CMPS 211 JavaScript Topic 1 JavaScript Syntax. 2Outline Goals and Objectives Goals and Objectives Chapter Headlines Chapter Headlines Introduction Introduction.
CHAPTER 4 Java Script อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
Introduction to JavaScript Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan. 1.
Pemrograman Teknologi Internet W06: Functions and Events.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Button and Textbox. Input  Input objects are used to obtain input from the user viewing the webpage. They allow the user to interact with the Web. 
TO CALCULATE MEAN AND MEDIAN MARIA FATIMA BS-CS-1.
Review of the DOM Node properties and methods Some ways of accessing nodes Appending, copying and removing nodes Event handling – Inline – Scripting –
1 Chapter 3 – JavaScript Outline Introduction Flowcharts Control Structures if Selection Structure if/else Selection Structure while Repetition Structure.
JavaScript Challenges Answers for challenges
Javascript JavaScript is what is called a client-side scripting language:  a programming language that runs inside an Internet browser (a browser is also.
JavaScript 101 Introduction to Programming. Topics What is programming? The common elements found in most programming languages Introduction to JavaScript.
SetTimeout()  What if you want to automatically cycle through the pics?  So you don’t have to keep clicking the button to see the next pic  Use the.
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.
Tutorial 11 1 JavaScript Operators and Expressions.
Introduction 1.HTML DOM events allow JavaScript to register different event handlers on elements in an HTML document. 2.Events are normally used in combination.
GetElementById changes outside forms. From form to page  Identified the field by using name  Form.field  Outside a form, use id  Unique on the page.
This is our seminar JavaScript And DOM This is our seminar JavaScript And DOM.
Link. setTimeout() What if you want to automatically cycle through the pics? So you don’t have to keep clicking the button to see the next pic Use the.
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.
Prime Factorization. What is Prime Factorization? The process of converting a number into a product of prime numbers.
CSD 340 (Blum)1 Introducing Text Input elements and Ifs.
CSC 121 Computers and Scientific Thinking Fall Event-Driven Programming.
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
JavaScript Events. Understanding Events Events add interactivity between the web page and the user Events add interactivity between the web page and the.
Changing CSS Styles via JavaScript No readings?. 2 Review? You can change the CSS styling of an element with JavaScript Syntax is similar to accessing.
Client-side (JavaScript) Validation. Associating a function with a click event – Part 1 Use the input tag’s onclick attribute to associate a function.
Brief Look InTo JavaScript Dr. Thomas Hicks Computer Science Department Trinity University.
Java Script and the DOM DOM stands for: –The Document Object Model When a browser reads a web page, it converts it’s contents from HTML into a hierarchical.
Introduction to.
Moving away from alert() Using innerHTML Using an empty div section
Week 3: Introduction to Javascript
Intro to JavaScript CS 1150 Spring 2017.
Developed by Start.
Click here for the answer. Click here for the answer.
Click here for the answer. Click here for the answer.
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
Section 10.1 YOU WILL LEARN TO… Define scripting
Click here for the answer. Click here for the answer.
JavaScript Introduction
We are starting to program with JavaScript
We are starting JavaScript. Here are a set of examples
Chapter 15: GUI Applications & Event-Driven Programming
Javascript and JQuery SRM DSC.
Writing to the Page Formatting Forms
This shows running the first guess number program which only allows one guess - I show the correct answer for testing purposes.
How to add a photo gallery in html/css
Presentation transcript:

Javascript Tools Document Object Model Problem Modeling & Solution Interaction Diagram Javascript Example quizzer06.html under Javascript-Examples > JavaScript-DOM - Purpose

innerHTML div tags time delayed functions data conversion - timed, random calculation game random numbers Javascript

1. User requests an arithmetic problem. 2. JS-App generates a random problem for the user. 3. User has limited time to answer. 4. JS-App evaluates user's answer and posts result. System Behavior User JS-App

Question Enter answer here 1 - User 2 - App What is ? 3- User Sorry - correct answer is = App

How to make random numbers ?

Making random no.s - Math.random ( )20 *+.5 Math.round ( ) < r < 1 0 < r < 20.5 < r < RANDOM eliminates easy problems like 2+13

How to replace existing Html ?

w = " What is " document.getElementById( 1 ).innerHTML = w Manufacture random arithmetic question Replace HTML for element where id=1 +x++y+" plus "" ? " INNERHTML

Question Enter answer here div area with id What is ? Access input via id use innerHTML to change use getElementById to get & change

How to make browser delay or wait ?

setTimeout (, )3500"F2( )" Executed after 3500 millisecond delay Built-in Javascript function delayed execution of F2 Gives user time to answer DELAYS

Generates question Evaluates answer Posts response question() answer() delay Waits for answer Temporal Logic setTimeout ("answer()", 3000 )

How to make convert numbers to the correct type ?

z = document.getElementById(2).value z = parseInt (z) Get user input Make z into a number Data conversion

w = " What is " document.getElementById( 1 ).innerHTML = w Manufacture random arithmetic question Replace HTML for element where id=1 +x++y+" plus "" ? " INNERHTML

w = " Sorry, the correct answer is " document.getElementById( 1 ).innerHTML = Construct response to user's answer replaces div's HTML +x++y+" + "" =" INNERHTML +z w Question Answer here

Desired behavior user app Asks for question Makes the question Waits for response 1 - User requests an arithmetic problem. 2 - JS App posts a random problem to the user.

Some useful diagrams for Interactions

Interaction Diagram UserJS app User requests question Click button User thinks App builds the question Posts the question App waits before getting user's answer ( ) Enters answer App gets user's answer early late Constructs response to user's answer & posts

Function calls UserJS app User requests question Click button question ( ) makes delayed call to answer( ) answer ( ) function - triggered by click function - called by question