Pertemuan 11 JavaScript.

Slides:



Advertisements
Similar presentations
JavaScript 101 Lesson 01: Writing Your First JavaScript.
Advertisements

UNIT 5 FUNCTIONS, OBJECTS, CONDITIONS, AND LOOPS.
The Web Wizard’s Guide To JavaScript Chapter 6 Working with Dates and Times.
The Web Wizard’s Guide To JavaScript Chapter 6 Working with Dates and Times.
Working with background, images and date object Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.
1 JavaScript 1. 2 Java vs. JavaScript Java –Is a high level programming language –Is platform independent –Runs on a standardized virtual machine.
CNIT 133 Interactive Web Pags – JavaScript and AJAX How to run JavaScript?
Parts of the Clock Click on the minute hand. Click on the clock’s face.
7-Jul-16 JavaScript Examples. Getting the date var d = new Date() document.write(d.getDate() + "/") document.write((d.getMonth() + 1) + "/") document.write(d.getFullYear())
JavaScript Non Primitive Datatype
Working with Date ISYS 350.
Java Script Date Object
Pertemuan 3 JavaScript.
JavaScript.
Build in Objects In JavaScript, almost "everything" is an object.
Creating a Programmable Web Page
Introduction to Programming
Moving away from alert() Using innerHTML Using an empty div section
Javascript Engine in Netstorm
Hägerstrand.org an interactive, web-based, dynamic time space cube service, driven by a graph database Bernhard Snizek, COST-MOVE WG4.
5 Day Forecast Mon Tues Wed Thu Fri.
LOOPING DAN FUNCTION Pertemuan 5.
Pertemuan 7 JavaScript.
HTML & teh internets.
JavaScript - Errors & Exceptions Handling
JAVA Script : Functions Ashima Wadhwa
Web Development & Design Foundations with HTML5 7th Edition
Java Script.
setInterval window.setInterval (statement, interval);
My First Web Page document.write("" + Date() + ""); To insert.
JavaScript Arrays Date
WEB APPLICATION PROGRAMMING
© Copyright 2016, Fred McClurg All Rights Reserved
Chapter 6: Conditional Statements and Loops
Your Trainer: Caroline Barnes
JavaScript Objects.
Introduction to JavaScript
BY: SITI NURBAYA ISMAIL FACULTY of COMPUTER and MATHEMATICAL SCIENCES
يمكن استدعاء الكود الوظيفي عند حدث معين أو عند استدعاء الكود الوظيفي .
Javascript: variables and parameters
Objects as Variables Featuring the Date Object
Pertemuan 3 JavaScript.
Pertemuan 10 JavaScript.
Introduction to JavaScript
Functions, Part 2 of 2 Topics Functions That Return a Value
Introduction to JavaScript for Python Programmers
يمكن استدعاء الكود الوظيفي عند حدث معين أو عند استدعاء الكود الوظيفي .
with a value of javascript:onclick=resizeWindow()
Lect2 (MCS/BCS) Javascript.
JavaScript onLoad arrays
Array?.
Javascript.
CSC318 – WEB APPLICATION DEVELOPMENT
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.
Pertemuan 10 JavaScript.
JavaScript Examples 27-Apr-19.
Independent Reading Novel- Show me what you read!
JavaScript Examples 30-Apr-19.
Name _________________________ Date _______________
HTML5 Demo ISYS 350.
24 3 Parents: No Book Reports due in Nov. or Dec. q Homework Due Today
JAVASCRIPT HOW TO PROGRAM -2
The Web Wizard’s Guide To JavaScript
Introduction to JavaScript
Introduction to JavaScript
INFO/CSE 100, Spring 2006 Fluency in Information Technology
JavaScript Examples 12-Jul-19.

Pertemuan 12 JavaScript.
Presentation transcript:

Pertemuan 11 JavaScript

Date Object Return today's date and time getTime() setFullYear() toUTCString() getDay() Display a clock

Return today's date and time <html> <body> <script type="text/javascript"> document.write(Date()); </script> </body> </html> Wed Nov 19 2008 11:23:48 GMT+0700 (SE Asia Standard Time)

getTime() <html> <body> <script type="text/javascript"> var minutes = 1000*60; var hours = minutes*60; var days = hours*24; var years = days*365; var d = new Date(); var t = d.getTime(); var y = t/years; document.write("It's been: " + y + " years since 1970/01/01!"); </script> </body> </html> It's been: 38.91009797910325 years since 1970/01/01!

Tue Nov 03 1992 11:28:22 GMT+0700 (SE Asia Standard Time) setFullYear() <html> <body> <script type="text/javascript"> var d = new Date(); d.setFullYear(1992,10,3); document.write(d); </script> </body> </html> Tue Nov 03 1992 11:28:22 GMT+0700 (SE Asia Standard Time)

toUTCString() <html> <body> <script type="text/javascript"> var d = new Date(); document.write (d.toUTCString()); </script> </body> </html> Wed, 19 Nov 2008 04:29:25 GMT

getDay() <html> <body> <script type="text/javascript"> var d=new Date(); var weekday=new Array(7); weekday[0]="Sunday"; weekday[1]="Monday"; weekday[2]="Tuesday"; weekday[3]="Wednesday"; weekday[4]="Thursday"; weekday[5]="Friday"; weekday[6]="Saturday"; document.write("Today it is " + weekday[d.getDay()]); </script> </body> </html> Today it is Wednesday

Display a clock Menampilkan jam sekarang <html> <head> <script type="text/javascript"> function startTime() { var today=new Date(); var h=today.getHours(); var m=today.getMinutes(); var s=today.getSeconds(); // add a zero in front of numbers<10 m=checkTime(m); s=checkTime(s); document.getElementById('txt').innerHTML=h+":"+m+":"+s; t=setTimeout('startTime()',500); } function checkTime(i) if (i<10) i="0" + i; return i; </script> </head> <body onload="startTime()"> <div id="txt"></div> </body> </html> Menampilkan jam sekarang

Tugas