Pertemuan 3 JavaScript.

Slides:



Advertisements
Similar presentations
ECMM6018 Enterprise Networking For Electronic Commerce Tutorial 4 Client Side Scripting JavaScript Looping.
Advertisements

ISP 121 Algorithmsand Computer Programming. Why Know Simple Programming?  You can create powerful macros in Access / Excel / Word / ??? to manipulate.
Conditional Statements and Loops. Today’s Learning Goals … Learn about conditional statements and their structure Learn about loops and their structure.
Tutorial 12 Working with Arrays, Loops, and Conditional Statements
Selection Statements choice of one among several blocks of code Java supports 3 kinds of selection statements: if statement – selects one block or leaves.
Tutorial 4 Decision Making with Control Structures and Statements Section A - Decision Making JavaScript Tutorial 4 -Decision Making with Control.
آموزش طراحی وب سایت جلسه دهم – جاوا اسکریپت 1 تدریس طراحی وب برای اطلاعات بیشتر تماس بگیرید تاو شماره تماس: پست الکترونیک :
Client-Side programming with JavaScript 3
IDK0040 Võrgurakendused I harjutus 07: PHP: Operators, Switch, Forms Deniss Kumlander.
Conditional Statements While writing a program, there may be a situation when you need to adopt one path out of the given two paths. So you need to make.
1 JavaScript 1. 2 Java vs. JavaScript Java –Is a high level programming language –Is platform independent –Runs on a standardized virtual machine.
CIS 375—Web App Dev II JavaScript II.
LOGO Conditional Statements & Loops in JavaScript CHAPTER 10 Eastern Mediterranean University School of Computing and Technology Department of Information.
1 JavaScript
Chapter 15 JavaScript: Part III The Web Warrior Guide to Web Design Technologies.
COMP403 Web Design JAVA SCRİPTS Tolgay KARANFİLLER.
In God we trust Learning Java Script. Java Script JavaScript is the scripting language of the Web! JavaScript is used in millions of Web pages to improve.
CSI 3125, Preliminaries, page 1 Control Statements.
Chapter 5: Intro to Scripting CIS 275—Web Application Development for Business I.
JavaScript JavaScript ( Condition and Loops ). Conditional Statements If Statement If...else Statement if (condition) { code to be executed if condition.
 Very often when you write code, you want to perform different actions for different decisions. You can use conditional statements in your code to do.
PHP Condtions and Loops Prepared by Dr. Maher Abuhamdeh.
Pertemuan 3 JavaScript.
Introduction to Calculated Columns Variables, Conditionals, and String Manipulation PRESENTER: Cameron Blashka| Informer Implementation Specialist| April.
CHAPTER 4 DECISIONS & LOOPS
JavaScript Tutorial Second lecture 22/2/2016.
LOOPING DAN FUNCTION Pertemuan 5.
Pertemuan 7 JavaScript.
HTML & teh internets.
JavaScript - Errors & Exceptions Handling
Tutorial 12 Working with Arrays, Loops, and Conditional Statements
Client-Side Scripting with JavaScript Barry Sosinsky Valda Hilley
Barb Ericson Georgia Institute of Technology May 2006
JavaScript Loops.
Exploring JavaScript Ch 14
My First Web Page document.write("" + Date() + ""); To insert.
WEB APPLICATION PROGRAMMING
Chapter 6: Conditional Statements and Loops
Expressions and Control Flow in JavaScript
JavaScript.
CHAPTER 4 CLIENT SIDE SCRIPTING PART 2 OF 3
Struktur Control : Decision
Control Structures.
JavaScript Selection Statement Creating Array
IF if (condition) { Process… }
Pertemuan 11 JavaScript.
The Web Wizard’s Guide To JavaScript
My First Web Page document.write("" + Date() + ""); To insert.
JavaScript Defined General Syntax Body vs. Head Variables Math & Logic
CS105 Introduction to Computer Concepts
Unit 6 part 3 Test Javascript Test.
High Level Programming Languages
Objectives In this chapter, you will:
Relational & Logical Operators, if and switch Statements
Mid-Term Review Good Results Always Answer Questions
Conditional Statements & Loops in JavaScript
Style properties in 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.
Pertemuan 13 JavaScript.
Program Flow.
There many situations comes in real life when we need to make some decisions and based on these decisions, we decide what should we do next. Similar situations.
BIT116: Scripting Lecture 6 Part 1
The <script> Tag
Javascript data structures
Web Programming– UFCFB Lecture 13
Programming Basics Review
CS105 Introduction to Computer Concepts JavaScript
How to allow the program to know when to stop a loop.
Pertemuan 12 JavaScript.
Presentation transcript:

Pertemuan 3 JavaScript

Conditional If statement If else If , else if, else statement Switch statement

If statement if (condition) { code to be executed if condition is true <html> <body> <script type="text/javascript"> var d = new Date(); var time = d.getHours(); if (time < 10) { document.write("<b>Good morning</b>"); } </script> <p> This example demonstrates the If statement. </p> If the time on your browser is less than 10, you will get a "Good morning" greeting. </body> </html> if (condition) { code to be executed if condition is true }

If else if (condition) { code to be executed if condition is true } <html> <body> <script type="text/javascript"> var d = new Date(); var time = d.getHours(); if (time < 10) { document.write("<b>Good morning</b>"); } else document.write("<b>Good day</b>"); </script> <p> This example demonstrates the If...Else statement. </p> If the time on your browser is less than 10, you will get a "Good morning" greeting. Otherwise you will get a "Good day" greeting. </body> </html> if (condition) { code to be executed if condition is true } else code to be executed if condition is not true

If, else if, else statement <html> <body> <script type="text/javascript"> var d = new Date(); var time = d.getHours(); if (time<10) { document.write("<b>Good morning</b>"); } else if (time>=10 && time<16) document.write("<b>Good day</b>"); else document.write("<b>Hello World!</b>"); </script> <p> This example demonstrates the if..else if...else statement. </p> </body> </html> if (condition1) { code to be executed if condition1 is true } else if (condition2) code to be executed if condition2 is true else code to be executed if condition1 and condition2 are not true

Switch ststement switch(n) { case 1: execute code block 1 break; <html> <body> <script type="text/javascript"> var d = new Date(); theDay=d.getDay(); switch (theDay) { case 5: document.write("<b>Finally Friday</b>"); break; case 6: document.write("<b>Super Saturday</b>"); case 0: document.write("<b>Sleepy Sunday</b>"); default: document.write("<b>I'm really looking forward to this weekend!</b>"); } </script> <p>This JavaScript will generate a different greeting based on what day it is. Note that Sunday=0, Monday=1, Tuesday=2, etc.</p> </body> </html> switch(n) { case 1: execute code block 1 break; case 2: execute code block 2 default: code to be executed if n is different from case 1 and 2 }

Tugas Buat program JavaScript yang akan melaporkan ; Nama hari ini Tanggal hari ini Waktu sekarang Pagi Siang Sore Malam