Thursday, April 4, 2013

Javascript Image Object Methods


The Image object represents an embedded image.

Image Object Properties
Align Sets or returns how to align an image according to the surrounding text
Alt Sets or returns an alternate text to be displayed, if a browser cannot show an image
Border Sets or returns the border around an image
Complete Returns whether or not the browser has finished loading the image
Height Sets or returns the height of an image
Hspace Sets or returns the white space on the left and right side of the image
Id Sets or returns the id of the image
isMap Returns whether or not an image is a server-side image map
longDesc Sets or returns a URL to a document containing a description of the image
Lowsrc Sets or returns a URL to a low-resolution version of an image
Name Sets or returns the name of an image
Src Sets or returns the URL of an image
useMap Sets or returns the value of the usemap attribute of an client-side image map
Vspace Sets or returns the white space on the top and bottom of the image
Width Sets or returns the width of an image

Javascript Form Objects attributes and Methods


Form Object Properties
acceptCharset Sets or returns a list of possible character-sets for the form data
Action Sets or returns the action attribute of a form
Enctype Sets or returns the MIME type used to encode the content of a form
Id Sets or returns the id of a form
Length Returns the number of elements in a form
Method Sets or returns the HTTP method for sending data to the server
Name Sets or returns the name of a form
Target Sets or returns where to open the action-URL in a form

Form Object Methods
reset() Resets the values of all elements in a form
submit() Submits a form

Javascript Mouse and Keyboard Attributes


altKey Returns whether or not the "ALT" key was pressed when an event was triggered
Button Returns which mouse button was clicked when an event was triggered
clientX Returns the horizontal coordinate of the mouse pointer when an event was triggered
clientY Returns the vertical coordinate of the mouse pointer when an event was triggered
ctrlKey Returns whether or not the "CTRL" key was pressed when an event was triggered
metaKey Returns whether or not the "meta" key was pressed when an event was triggered
relatedTarget Returns the element related to the element that triggered the event
screenX Returns the horizontal coordinate of the mouse pointer when an event was triggered
screenY Returns the vertical coordinate of the mouse pointer when an event was triggered
shiftKey Returns whether or not the "SHIFT" key was pressed when an event was triggered

Other Event Attributes
Bubbles Returns a Boolean value that indicates whether or not an event is a bubbling event
Cancelable Returns a Boolean that indicates whether or not an event can be default action prevented
currentTarget Returns the element whose event listeners triggered the event
eventPhase Returns which phase of the event flow is currently being evaluated
Target Returns the element that triggered the event
timeStamp Returns the time stamp, in milliseconds, from the epoch (system start or event trigger)
Type Returns the name of the event

Javascript Button Object Properties and Event Handlers

The Button object represents a push button.

Button Object Properties
accessKey Sets or returns the keyboard key to access a button
Disabled Sets or returns whether a button should be disabled
Form Returns a reference to the form that contains the button
Id Sets or returns the id of a button
Name Sets or returns the name of a button
tabIndex Sets or returns the tab order for a button
Type Returns the type of form element a button is
Value Sets or returns the text that is displayed on a button

Event Handlers
Onabort Loading of an image is interrupted
Onblur An element loses focus
Onchange The content of a field changes
Onclick Mouse clicks an object
Ondblclick Mouse double-clicks an object
Onerror An error occurs when loading a document or an image
Onfocus An element gets focus
Onkeydown A keyboard key is pressed
Onkeypress A keyboard key is pressed or held down
Onkeyup A keyboard key is released
Onload A page or an image is finished loading
Onmousedown A mouse button is pressed
Onmousemove The mouse is moved
Onmouseout The mouse is moved off an element
Onmouseover The mouse is moved over an element
Onmouseup A mouse button is released
Onreset The reset button is clicked
Onresize A window or frame is resized
Onselect Text is selected
Onsubmit The submit button is clicked
Onunload The user exits the page

Javascript Methods on Document Object


The Document object represents the entire HTML document and can be used to access all elements in a page.

Document Object Collections
anchors[] Returns a reference to all Anchor objects in the document
forms[] Returns a reference to all Form objects in the document
images[] Returns a reference to all Image objects in the document
links[] Returns a reference to all Area and Link objects in the document

Document Object Properties
Body Gives direct access to the <body> element
Cookie Sets or returns all cookies associated with the current document
Domain Returns the domain name for the current document
lastModified Returns the date and time a document was last modified
Referrer Returns the URL of the document that loaded the current document
Title Returns the title of the current document
URL Returns the URL of the current document

Document Object Methods
close() Closes an output stream opened with the document.open() method
getElementById() Returns a reference to the first object with the specified id
getElementsByName() Returns a collection of objects with the specified name
getElementsByTagName() Returns a collection of objects with the specified tagname
open() Opens a stream to collect the output from any document.write() or document.writeln()
write() Writes HTML expressions or JavaScript code to a document
writeln() Identical to the write(), with the addition of writing a new line character after expression

Javascript History and Location Object


The History object is actually a JavaScript object, not an HTML DOM object.

History Object Methods
back() Loads the previous URL in the history list
forward() Loads the next URL in the history list
go() Loads a specific page in the history list

The Location object is actually a JavaScript object, not an HTML DOM object.
Location Object Properties
Hash Sets or returns the URL from the hash sign (#)
Host Sets or returns the hostname and port number of the current URL
Hostname Sets or returns the hostname of the current URL
Href Sets or returns the entire URL
Pathname Sets or returns the path of the current URL
Port Sets or returns the port number of the current URL
Protocol Sets or returns the protocol of the current URL
Search Sets or returns the URL from the question mark (?)

Location Object Methods
assign() Loads a new document
reload() Reloads the current document
replace() Replaces the current document with a new one

Javascript Screen Object Properties


The Screen object is actually a JavaScript object, not an HTML DOM object..

Screen Object Properties
availHeight Returns the height of the display screen (excluding the Windows Taskbar)
availWidth Returns the width of the display screen (excluding the Windows Taskbar)
bufferDepth Sets or returns the bit depth of the color palette in the off-screen bitmap buffer
colorDepth Returns the bit depth of the color palette on the destination device or buffer
deviceXDPI Returns the number of horizontal dots per inch of the display screen
deviceYDPI Returns the number of vertical dots per inch of the display screen
fontSmoothingEnabledReturns whether the user has enabled font smoothing in the display control panel
Height The height of the display screen
logicalXDPI Returns the normal number of horizontal dots per inch of the display screen
logicalYDPI Returns the normal number of vertical dots per inch of the display screen
pixelDepth Returns the color resolution (in bits per pixel) of the display screen
updateInterval Sets or returns the update interval for the screen
Width Returns width of the display screen