Console.

Slides:



Advertisements
Similar presentations
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Advertisements

HTML 5 and CSS 3, Illustrated Complete Unit L: Programming Web Pages with JavaScript.
1 Programmer-Defined Functions Functions allow program modularization Variables declared in function are local variables Only known inside function in.
The Web Warrior Guide to Web Design Technologies
JavaScript Part for Repetition Statement for statement Cpecifies each of the items needed for counter-controlled repetition with a control variable.
 Inside attributes like onclick  As a section of code in the body  Only special cases  As a function in a separate file  Can link to it like the.
29 November JavaScript: Arrays and Iterations Functions.
Javascript II Expressions and Data Types. 2 JavaScript Review programs executed by the web browser programs embedded in a web page using the script element.
JAVASCRIPT TIPS. REMEMBER JAVASCRIPT IS VERY, VERY CASE SENSITIVE.
Lesson15. JavaScript Objects Objects encapsulate data (properties) and behavior(methods); the properties and the methods of an object are tied together.
JavaScript Form Validation
CSC318 – DYNAMIC WEB APPLICATION DEVELOPMENT
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
CISC474 - JavaScript 03/02/2011. Some Background… Great JavaScript Guides: –
JavaScript: Functions © by Pearson Education, Inc. All Rights Reserved.
Javascript. Outline Introduction Fundamental of JavaScript Javascript events management DOM and Dynamic HTML (DHTML)
Writing a JavaScript User-Defined Function  A function is JavaScript code written to perform certain tasks repeatedly  Built-in functions.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
Introduction.  The scripting language most often used for client-side web development.  Influenced by many programming languages, easier for nonprogrammers.
Topics Sending an Multipart message Storing images Getting confirmation Session tracking using PHP Graphics Input Validators Cookies.
Conditional Statements.  Checking if input is a number  Radio buttons  Check boxes 2.
JavaScript Programming Unit #1: Introduction. What is Programming?
JavaScript, Fourth Edition
Chapter 10: JavaScript Functions CIS 275—Web Application Development for Business I.
DYNAMIC HTML What is Dynamic HTML: HTML code that allow you to change/ specify the style of your web pages. Example: specify style sheet, object model.
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.
Modifying HTML attributes and CSS values. Learning Objectives By the end of this lecture, you should be able to: – Select based on a class (as opposed.
1 JavaScript Part 3. Functions Allow the user to decide when a particular script should be run by the browser in stead of running as long as the page.
Unit 10 – JavaScript Validation Instructor: Brent Presley.
COP 3813 Intro to Internet Computing Prof. Roy Levow Lecture 4 JavaScript.
Introduction to Programming and JavaScript. Programming.
1/25/2016B.Ramamurthy1 Exam3 Review CSE111 B.Ramamurthy.
Javascript Overview. What is Javascript? May be one of the most popular programming languages ever Runs in the browser, not on the server All modern browsers.
Functions Function is a standalone block of statements that performs some tasks and returns a value. Functions must be declared before they can be used.
JavaScript Functions. CSS Inheritance Which formatting applies? x y z input { display: block; } input.pref { background:red; } If you have a selector.
JavaScript Introduction and Background. 2 Web languages Three formal languages HTML JavaScript CSS Three different tasks Document description Client-side.
JavaScript and Ajax (JavaScript Functions) Week 5 Web site:
Expressions and Data Types Professor Robin Burke.
JavaScript Tutorial First lecture 19/2/2016. Javascript is a dynamic computer programming language. It is lightweight and most commonly used as a part.
 Collection of statements that can be invoked as a unit  Can take parameters  Can be used multiple times  Can call without knowing what they do or.
REEM ALMOTIRI Information Technology Department Majmaah University.
Week-12 (Lecture-1) Cascading Style Sheets (CSS): describe how documents are presented on screens. Types of Style Sheets: External Style Sheet - Define.
CSS Colors, JavaScript Variables, Conditionals and Basic Methods
Build in Objects In JavaScript, almost "everything" is an object.
>> JavaScript: Location, Functions and Objects
HTML & teh internets.
JavaScript.
Variables and Data Types
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
JavaScript functions.
Project 9 Creating Pop-up Windows, Adding Scrolling Messages, and Validating Forms.
JavaScript Loops.
JavaScript Functions.
Web Programming– UFCFB Lecture 17
More Selections BIS1523 – Lecture 9.
Conditions and Ifs BIS1523 – Lecture 8.
Javascript: variables and parameters
JavaScript Functions.
Integrating JavaScript and HTML
Javascript Game Assessment
Reviewing key concepts
Due Next Monday Assignment 1 Start early
Javascript.
For this assignment, copy and past the XHTML to a notepad file with the .html extension. Then add the code I ask for to complete the problems.
CSCI N207 Data Analysis Using Spreadsheet
CSCI N207 Data Analysis Using Spreadsheet
Introduction to Computer Science
JavaScript functions.
Functions, Part 1 of 2 Topics Using Predefined Functions
Presentation transcript:

Console

Two key uses Error Messages Print Stmts If you see an error message Don’t panic Use it to help Like validation Tries its best Error often earlier Remember: JavaScript executes one statement at a time in order Track work Can leave it forever

Variables

Variable Values Save into a variable and the value changes Use a variable (like printing) and the value does NOT change

Illustration

JavaScript Function

What is a function? Collection of statements that can be invoked as a unit Because sometimes we want to do more that a single assignment!

Different Types of Functions Who writes? JavaScript provides Someone else writes & you use You write

Does function need information? Alert does…tell it what to write Asking for a random number doesn’t Always need to use () Pass data if needed () if not

Parameters Math.round: Number to round Call a function with a different value every time MUST give it everything that it expects alert or console.log: string to print Math.round: Number to round

Statement or part of an expression Alert is a statement; doesn’t give you anything back If you ask for a random number, you expect to get something back

Functions as Statements Performs an action but doesn’t give you anything back Example: alert

Alert String to print Function

Writing a Function

Format of a Function functionName(parm,parm); Always needs () even if no parameter functionName(); For now: no parameter

JavaScript Functions Summary

alert console.log Takes an input value (string) Does not return a value

Getting a random number Math.random() Does not need any inputs Returns a value between 0 and 1

Other math functions Take an input value (number) Math.round(num) Math.floor(num) Math.ceil(num) Take an input value (number) Return a value (number)

Connecting JavaScript to HTML

Where Do JavaScript Functions Go? Like CSS, can be inline or a separate file Like CSS, an external file is considered better practice Like CSS, link to it from the head section

A Separate JavaScript File <script src="myscripts.js"></script> Myscript.js JavaScript option in komodo will work on it next

FUNCTION: connecting to HTML <head> <script src=“function.js”></script> </head> <body> <button type=“button” onclick=“doit();”> </body> HTML file name function name function doit () { alert(“Hi!”); } JAVASCRIPT (function.js)