Javascript


Related applications


Search a word:
   



© The scientific sentence. 2010


Predefined functions



1. Alert Box:


Generally, an alert box is popped up. It has to functions:
1.
alert("some text");
we will have to click "OK" to continue. 

2.
confirm ("some text");
It pops up "OK" and "Cancel" . The "OK" corresponds to true. 
the box returns false for "Cancel".

2. Prompt Box


<script type="text/javascript">
prompt("some text","default input value");
</script> 
It is used to input a value before accessing a page.

First enter an input value, then click either 
"OK" or "Cancel" to continue.

"OK" returns the input value, and "Cancel" returns null.


3. Date object:


The Date object is used to set dates and times. 

The syntax is:
var some_date = new Date();
some_date is a new object. By creating this instance, we can use all the 
methods of the Object Date(). For example:

var d = new Date();
var t = d.getTime();
//t in given in milli-second
var m = 365 * 24 * 60 * 60 * 1000;
document.write(t/m + "
"+d); That ouputs: 38.518340607242514 Sun Jun 29 2008 00:39:49 GMT-0400 (Eastern Daylight Time) The object d - new Date(); is today The object var t = d.getTime(); is the number of years since January 1st, 1970. var day = d.getDay(); document.write(day); Outputs 0 , that is Sunday.
  
Google
Web
ScientificSentence
 




chimie labs
|
scientific sentence
|
java
|
php
|
green cat
|
contact
|


© Scientificsentence 2009. All rights reserved.