Home > Javascript > DOM

DOM


1.) document.getElementById(‘id’): You can access virtually any element in            the DOM. Here is the syntax …
document.getElementById(‘id’)
Example:
a.) var obj    =    document.getElementById(‘id’);
alert(obj.value); {get value of a element}
alert(obj.title);  {get title of a element}
obj.style.color=’red’;  {Change color of a element}
b.) var obj    =    document.getElementById(‘id’).value;{get value of a element}
var obj1  =    document.getElementById(‘id).title; {get title of a element}

 

The different node methods available through DOM manipulation are as follows:
node.childNodes
node.firstChild
node.lastChild
node.parentNode
node.nextSibling
node.previousSibling
Advertisements
Categories: Javascript
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: