11.12.2012 Views

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

"move", "copyLink", "copyMove", "linkMove", "all", "none", and "unitialized". <strong>The</strong> default<br />

value is uninitialized, which allows the drag-and-drop effect to work though its type is<br />

not queriable via the property. (IE5+)<br />

Methods<br />

clearData([sDataFormat]) Clears the data in the dataTransfer object. <strong>The</strong> optional<br />

sDataFormat parameter can be set to "Text", "URL", "File", "HTML", or "Image" to<br />

indicate the type of data to remove. (IE 5+)<br />

getData(sDataFormat) Returns the data in the defined sDataFormat (either "Text" or<br />

"URL") from the dataTransfer or clipboardData object. (IE 5+)<br />

setData(sDataFormat,sData) Assigns string data defined by sData in the specified<br />

format defined by sDataFormat (either "Text" or "URL") to the dataTransfer or<br />

clipboardData object (IE5+)<br />

Support<br />

IE 5+<br />

Date (Built-in Object)<br />

<strong>The</strong> Date object provides a wide variety of methods for manipulating dates and times. It is<br />

important to remember that Date instances do not contain a ―ticking clock‖ but rather hold a<br />

static date value. Internally, the date is stored as the number of milliseconds since the epoch<br />

(midnight of January 1, 1970 UTC). This accounts for the prominent role of milliseconds in<br />

many Date methods.<br />

Milliseconds, seconds, minutes, hours, and months are enumerated beginning with zero; so, for<br />

example, December is month 11. Days are enumerated beginning with 1. Years should always<br />

be given using four digits. Modern implementations permit years as much as several hundred<br />

thousand years in the past or future, although older implementations often have trouble<br />

handling dates before 1970. Many implementations have trouble handling dates before 1 A.D.<br />

Note that Universal Coordinated Time (UTC) is the same as Greenwich Mean Time (GMT).<br />

Constructor<br />

var instanceName = new Date();<br />

var instanceName = new Date(milliseconds);<br />

var instanceName = new Date(stringDate);<br />

var instanceName = new Date(year, month, day [, hrs [, mins [, secs [, ms]]]]);<br />

<strong>The</strong> first constructor syntax creates a new Date instance holding the current date and time. <strong>The</strong><br />

second syntax creates an instance holding the date given by the number of milliseconds given<br />

in the numeric milliseconds argument. <strong>The</strong> third syntax attempts to create an instance by<br />

converting the string stringDate into a valid date using the parse() method (see under the<br />

―Methods‖ section). <strong>The</strong> fourth syntax creates an instance according to its numeric arguments.<br />

If the optional parameters are omitted, they are filled with zero.<br />

Properties<br />

constructor <strong>Reference</strong> to the constructor object, which created the object. (IE4+<br />

(JScript <strong>2.0</strong>+), MOZ, N3+ (<strong>JavaScript</strong> 1.1+), ECMA Edition 1)<br />

prototype <strong>Reference</strong> to the object‘s prototype. (IE4+ (JScript <strong>2.0</strong>+), MOZ, N3+<br />

(<strong>JavaScript</strong> 1.1+), ECMA Edition 1)<br />

Methods<br />

getDate() Returns a numeric value indicating the day of the month (1-based). (IE3+<br />

(JScript 1.0+), MOZ, N2+ (<strong>JavaScript</strong> 1.0+), ECMA Edition 1)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!