Introduction to Programming

Slides:



Advertisements
Similar presentations
Enumeration Data Type enum Day {SUN, MON, TUE, WED, THU, FRI, SAT}; Day today; today = WED; if (today == FRI) cout
Advertisements

Adding JavaScript (<script tag>)
CSC318 – DYNAMIC WEB APPLICATION DEVELOPMENT
INTRODUCTION TO CLIENT-SIDE WEB PROGRAMMING ACM 511 ACM 262 Course Notes.
Week 9 PHP Cookies and Session Introduction to JavaScript.
Topic: An Introduction to JavaScript - from Beginning JavaScript by Wilton (WROX)
Arrays “Array, I'm bound array, 'cross the wide Missouri.” ‒ Old Programmer’s Folk Song © Copyright 2014, Fred McClurg All Rights Reserved.
JavaScript Programming Unit #1: Introduction. What is Programming?
Making dynamic pages with javascript Lecture 1. Java script java versus javascript Javascript is a scripting language that will allow you to add real.
Build in Objects In JavaScript, almost "everything" is an object.
5 Day Forecast Mon Tues Wed Thu Fri.
JavaScript - Errors & Exceptions Handling
LINE graphs SPI & SPI SPI & SPI
Programming the Web using XHTML and JavaScript
My First Web Page document.write("" + Date() + ""); To insert.
JavaScript Arrays Date
Don't leave yourself short of medication this Christmas!!
Chapter 6: Conditional Statements and Loops
GANTT CHARTS Example Example Example Example text Tasks Example 1
HTML.
Mon – 2Tue – 3Wed – 4Thu - 5Fri - 6Sat - 7Sun - 8 Mon – 9Tue – 10Wed – 11Thu - 12Fri – 13Sat – 14Sun -15 Mon – 16Tue – 17Wed – 18Thu - 19Fri – 20Sat –
Introduction to JavaScript
JavaScript and Ajax (Expression and Operators)
Introduction to HTML Today we will look at:

A second look at JavaScript
Javascript الجافا سكربت هي لغة برمجه اذا جاز التعبیر تلعب دور حیوي وفعال في صفحات الویب من خلال القیام بوظائف قد تكون خارجیة او داخلیة بل لنكن اكثر دقة.
Your 1st Programming Assignment
به نام خداوند خورشید و ماه
October 2011 October 2011 Name: __________________________
Introduction to DOM.
Blank Food Diary template
Blank Fitness Diary template
MON TUE WED THU
Introduction to JavaScript for Python Programmers
GANTT CHARTS Example Text Text Here Text Here Text Here Text Here
Strings A collection of characters taken as a set:
January MON TUE WED THU FRI SAT SUN
January MON TUE WED THU FRI SAT SUN
My First Web Page document.write("" + Date() + ""); To insert.

There Was Virtually No Difference In TV’s Social Popularity Between May And The Post Memorial Day Time Period TV-related topics dominated social conversations.
January Sun Mon Tue Wed Thu Fri Sat
January MON TUE WED THU FRI SAT SUN
January MON TUE WED THU FRI SAT SUN
HTML scripts.
2008 Calendar.
Conditional Statements & Loops in JavaScript
CSC318 – DYNAMIC WEB APPLICATION DEVELOPMENT
Arrays Topics Definition of a Data Structure Definition of an Array
Sun Mon Tue Wed Thu Fri Sat
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.
Hundred Dollar Questions
Loops and Arrays in JavaScript
2016 Wellness Calendar
Introduction to JavaScript
Tutorial 10: Programming with javascript
Sun Mon Tue Wed Thu Fri Sat
Name: ______________________________
1/○~1/○ weekly schedule MON TUE WED THU FRI SAT SUN MEMO
7 Week Feb 3 Mon: NTI Tues: Video Comparison/ 3.8 paragraph
2016 | 10 OCT SUN MON TUE WED THU FRI SAT
Sun Mon Tue Wed Thu Fri Sat
WEB PAGES: Tables Welcome Back !.
Arrays Topics Definition of a Data Structure Definition of an Array
Web Programming and Design
1 January 2018 Sun Mon Tue Wed Thu Fri Sat
Lecture 9: JavaScript Syntax
2008 Calendar.
CS100A Lect. 12, 8 Oct More About Arrays
Presentation transcript:

Introduction to Programming JAVASCRIPT Introduction to Programming

Javascript

Javascript

Javascript

Javascript

Javascript

Javascript

Javascript <html> <head> <title>My Web Page</title> <script type="text/javascript"> alert('hello world!'); </script> </head>

Javascript <html> <head> <title>My Web Page</title> <script type="text/javascript" src="navigation.js"></script> </head>

Javascript

Javascript

Javascript

Javascript

Javascript

Javascript

Javascript

Javascript

Javascript

Javascript

Javascript <script type="text/javascript"> var firstName = 'Cookie'; var lastName = 'Monster'; document.write('<p>'); document.write(firstName + ' ' + lastName); document.write('</p>'); </script>

Javascript <script type="text/javascript"> var name = prompt('What is your name?', ''); document.write('<p>Welcome ' + name + '</p>'); </script>

Javascript

Javascript Creating an Array To create and store items in an array, you first declare the array’s name (just as you would a variable) and then supply a list of comma separated values: each value represents one item in the list. To indicate an array, you put the list of items between opening and closing brackets—[ ]. var days = ['Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat', 'Sun']; The brackets—[ ]—are very important. You can create an empty array without any elements like this: var playList = [];

Javascript <script type="text/javascript"> var days = ['Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat', 'Sun']; alert(days[0]); var i = 4; //alert(days[i]); </script>

Javascript

Javascript <script type="text/javascript"> var properties = ['red', '14px', 'Arial']; properties[3] = 'bold'; properties[properties.length] = 'italic'; properties.push('bold'); properties.push('bold', 'italic', 'underlined'); properties.unshift('12px'); for(i=0;i<properties.length;i++) { document.write(properties[i]); document.write('</br>'); } </script>

Javascript

Javascript

Javascript

Javascript

Javascript

Adding Logic if ( condition ) { // some action happens here } if (score > 100) { alert('You won!'); if (answer == 31) { alert('Correct. Saturn has 31 moons.');

Adding Logic

Adding Logic

Adding Logic if (condition) { // write what happens } else if (condition2) { } else { }

Adding Logic <script type="text/javascript"> var num= prompt(‘Enter a number', ‘60'); if (num >= 50) { alert(‘Thanks.'); } </script>

Adding Logic var fridayCash = prompt('How much money can you spend?', ''); if (fridayCash >= 50) { alert('You should go out to a dinner and a movie.'); } else if (fridayCash >= 35) { alert('You should go out to a fine meal.'); } else if (fridayCash >= 12) { alert('You should go see a movie.'); } else { alert('Looks like you'll be watching TV.'); }

Adding Logic Logical AND if (a < 10 && a > 1) { alert("The value " + a + " is between 1 and 10"); } Logical OR if (key == 'n' || key == 'N') { //move to the next photo Logical NOT if (! valid) { //print errors and don't submit form}

Adding Logic if (dayOfWeek == 'Friday') { var fridayCash = prompt('How much money can you spend?', ''); if (fridayCash >= 50) { alert('You should go out to a dinner and a movie.'); } else if (fridayCash >= 35) { alert('You should go out to a fine meal.'); } else if (fridayCash >= 12) { alert('You should go see a movie.'); } else { alert('Looks like you'll be watching TV.'); }

Adding Logic

Adding Logic while (condition) { // javascript to repeat }

Adding Logic var num = 1; while (num <= 5) { document.write('Number ' + num + '<br>'); num = num + 1; } document.write('Number 1 <br>'); document.write('Number 2 <br>'); document.write('Number 3 <br>'); document.write('Number 4 <br>'); document.write('Number 5 <br>');

Adding Logic

Adding Logic

Adding Logic var num = 6; do{ document.write('Number ' + num + '<br>'); num = num + 1; } while (num <= 5) while (num <= 5) { }

Adding Logic

Introduction to Programming JAVASCRIPT Introduction to Programming