Monday, February 18, 2013

JavaScript Objects with description


Date Object Method
S. No.
Methods
Description
1.
getDate()
getUTCDate()
Returns a number from 1 to 31 representing the date of month in local time or UTC time.
2.
getDay()
getUTCDay()
Returns a number from0 to 6 (Zero for Sunday & Six for Saturday) representing the Day of the Week in local time.
3.
getFullYear()
getUTCFullYear()
Returns the year as a four digit number in local time.
4.
getHours()
getUTCHours()
Returns a number from 0 to 23 in local time or UTC.
5.
getMinutes()
getUTCMinutes()
Returns a number from 0 to 59 representing the minutes for the time in local time or UTC.
6.
getSeconds()
getUTCSeconds()
Returns a number from 0 to 59, representing the seconds for the time in local time or UTC.
7.
getMilliseconds()
getUTCMilliseconds()
Returns a number from 0 to 999 representing the number of milliseconds in local time or UTC.
8.
getMonth()
getUTCMonth()
Returns a number from 0 to 11 (0 for January & 11 for December) representing the month in local time or UTC.
9.
getTime()
Returns the no of milliseconds between January 1, 1970 & the time of the Date object.
10.
getTimeZoneOffset()
Returns the difference in minutes between the current time on the local computer & UTC.
11.
setDate(value)
setUTCDate(value)
Sets the date of the month (1 to 30) in local time or UTC.
12.
setFullYear(y,m,d)
setUTCFullYear(y,m,d)
Sets the year in local time or UTC. The second and third argument represents months and date which are optional.
13.
setHours(h,m,s,ms)
setUTCHours(h,m,s,ms)
Sets the hours in local time or UTC. Where second, third & forth argument are optional.
14.
setMinutes(m,s,ms)
setUTCMinutes(m,s,ms)
Sets the minutes in local time or UTC, The second, third arguments are optional where s for seconds and ms for milliseconds.
15.
setMonth(m,d)
setUTCMonth(m,d)
Sets the month in local time or UTC where second argument is optional.
16.
setSeconds(s,ms)
setUTCSeconds(s,ms)
Sets the second in local time or UTC. Where second argument is optional.
17.
setTime(ms)
setUTCTime(ms)
Sets the time based on its arguments (The number elapsed milliseconds.)
18.
toString()
Returns a string representing the Date and Time in a form like (Thu Sep 08:50:55 UTC 2012)
19.
valueOf()
It will work as gettime.

Math Object Method
S. No.
Methods
Description
1.
abs(x)
Absolute value of x.
Ex:
abs(7.2)=7.2
abs(-7.2)=7.2
2.
exp(x)
It represents exponent value of x.
Ex:
expx
3.
max(x,y)
Represents greater value.
4.
min(x,y)
Represents smaller value.
5.
pow(x,y)
Returns xy
6.
round(x)
This method round off x to the closest integer.
Ex:
round(9.8)=10
round(9.2)=9
7.
ceil(x)
It rounds x to the nearest smaller integer.
Ex:
ceil(9.8)=9
ceil(9.2)=9
8.
floor(x)
It rounds x to the nearest greater integer.
Ex:
floor(9.8)=10
floor(9.2)=10
9.
sqrt(x)
Returns square of x.

Boolean Object Method
S. No.
Methods
Description
1.
tostring()
It returns the string true if the value of the Boolean object is true otherwise it returns the string false.
2.
valueof()
It returns the value true if the Boolean object is true, otherwise return false.

String Object Method
S. No.
Methods
Description
1.
charAt(string)
It returns a string containing the character at a specified index. If there is no character at the index or string this method returns an empty string.
Ex:
charAt(“NiBm”);
2.
replace(search string,replace string)


3.
toUpperCase()
It returns a string in which all lower case letters will convert into Upper Case letters.
4.
toLowerCase()
It returns a string in which all lower case letters will convert into Lower Case letters.

Document Object Method
This object is used to manipulate the document that is currently visible in the browser window.
S. No.
Methods
Description
1.
getElementById(Id)
It returns the document object modelling node which represents the html element whose Id attribute matches the ID sent as argument.
2.
write(string)
Writes the string to the html document as html code.
3.
writeln(string)
Writes the string to the html document as html code and adds a new line character of the end.
4.
cookie()
A string containing a value of all the cookies stored on users computer for the current documents.
5.
lastmodified()
The date and the time that this document was last modified.

Window Object Method
The window object provides methods for manipulating browser windows. It is possible that a parent window can be classified into child windows.
S. No.
Methods
Description
1.
open(url,name,option)
Creates a new window with the URL of the window set to URL. The last two arguments are optional which represents the name of window and options provided for the window.
2.
close()
It closes the current window and deletes its object from the memory.
3.
focus()
This method gives focus to the window that means it put the window in foreground.
4.
blur()
This method takes focus away from the window that means it put the window in background.
5.
window.closed
This property contains a Boolean value that is set to true if the window is closed or false if it is open.


0 comments:

Post a Comment

Powered by Blogger.