Learn how to display the current date and how to perform math calculations using JavaScript.
Tutorial Details:
Code Beach - Displaying Current Date with JavaScript and Basic Math
Calculations
All .NET ASP BREW C++ C# ColdFusion Delphi/Kylix HTML J2ME Java JavaScript Palm Perl PHP Pocket PC Python SQL Ruby Symbian Visual Basic XML
Submit Link
Displaying Current Date with JavaScript and Basic Math Calculations by: Amrit Hallan
In HTML, there is no such thing as . We have to use either VBScript or JavaScript. Since here we are learning JavaScript, we'll be taking the services of JavaScript to display the current date on our web page.
Consider the following script:
See it in the browser.
HoldDate = new Date() creates a new date-type variable, that holds all the information that a date should have, like day, month, year, and time. If you have walked through the lanes of Object Oriented Programming, you'll understand that Date() is a class, and getDate() , getMonth() and getYear() are various methods encapsulated in this class. So the variable HoldDate practically inherits everything that is contained in Date() .
Whereas, alert() wrote the output in a popup window, document.write() writes the entire thing on your web page, as a part of your HTML text, and that is where the true power begins to manifest itself.
Read
Tutorial at: Click here to view the tutorial
Rate Tutorial: Javascript Date and Time Displaying Current Date with JavaScript and Basic Math Calculations Tutorial
View Tutorial: Javascript Date and Time Displaying Current Date with JavaScript and Basic Math Calculations Tutorial
Related
Tutorials:
Tip 80: Resize
applets within browser frames - JavaWorld
Tip 80: Resize
applets within browser frames - JavaWorld |
Add XML to your J2EE applications - JavaWorld February 2001
Integrate an XML presentation layer in the J2EE layered architecture |
Clean up your wire protocol with SOAP, Part 3 - JavaWorld June
2001
Clean up your wire protocol with SOAP, Part 3 - JavaWorld June
2001 |
Pushlets: Send
events from servlets to DHTML client browsers
Pushlets: Send
events from servlets to DHTML client browsers |
Working in Java time
Working in Java time |
Java scripting languages: Which is
right for you?
Java scripting languages: Which is
right for you? |
Transform data into Web applications with Cocoon
Transform data into Web applications with Cocoon |
JSP Standard Tag Library eases Webpage
development
JSP Standard Tag Library eases Webpage
development |
Nice
widget
Nice
widget |
Impressive
!
Impressive
! |
JCalendar Library provides a ComboBox (JCalendarComboBox) for selecting a Date and a simple Panel (JCalendarPanel) for s
It is coded with 2 rules:
* No hard coded Fonts or Colors, use the current Look and Feel
* No hard coded locale behaviour, use the default or a given Locale (Start of Week, Name of Days/Months)
|
Tools and Libraries for the Advancement of Sciences (was: J.A.D.E.)
Tools and Libraries for the Advancement of Sciences (was: J.A.D.E.)
Our Vision
To provide the most comprehensive Java TM library for the scientific community.
To create synergy between all sciences (e.g. math, physics, sociology, biology, astron |
A well-behaved Jetspeed portlet
This article presents a working example of how to construct a Jetspeed portlet that runs efficiently, adheres to the Model 2 architecture, and, by not interfering with additional portlets, plays well with others. In addition, I demonstrate some simple way |
Overview of Servlets and JSP
Servlets are Java technology's answer to CGI programming. They are programs that run on a Web server and build Web pages. Building Web pages on the fly is useful (and commonly done) for a number of reasons. |
Servlets and JavaServer Pages (JSP) : A Tutorial
An excellent tutorial on JSP and Servlets. |
J2J - Java to JavaScript integration.
It is a development tool lets you to integrate Java classes and JavaScript within your HTML pages. The main idea behind this product is how to call methods of Java classes right from JavaScript functions. |
Open Source Web Frameworks in Java
Open Source Web Frameworks in Java
Open Source Web Frameworks in Java
Struts
Struts Frame work is the implementation of Model-View-Controller (MVC) design pattern for the JSP. Struts is maintained as a part of Apache Jakarta project and is open |
JSP date example
JSP date example
JSP Date Example
Till now you learned about the JSP syntax, now I will show you how to create a simple dynamic JSP page that prints the current date and time. So the following code accomplish this:
<%@page contentType="text/html" |
Client Side Address Validation in Struts
Client Side Address Validation in Struts
Client Side Address Validation in Struts
In this lesson we will create JSP page for entering the address and use the functionality provided by Validator Framework to validate the user data on the browser. |
Struts Validator Framework Tutorial with Example
Struts Validator Framework Tutorial with Example
Struts HTML Tags
Struts Validator Framework
This lesson introduces you the Struts Validator Framework. In this lesson you will learn how to use Struts Validator Framework to validate the user |
|
|
|