1. document.getElementById(id-name)
2. document.getElementsByClassName(class-name)
3. document.getElementsByTagName(tag-name);
4. d.getElementsByName(name-attribute name);
Example
<!DOCTYPE html> <html lang='en' xmlns='http://www.w3.org/1999/xhtml'> <head> <meta charset='utf-8' /> <title></title> </head> <body> <p id='p2'></p> <p class='p3'></p> <p ></p> <p name='p1'></p> <script> document.getElementById('p2').innerHTML = 'this is id selector'; var cls = document.getElementsByClassName('p3'); cls[0].innerHTML = 'class selector'; var tags = document.getElementsByTagName('p'); tags[2].innerHTML = ' this is tag name selector'; var names = document.getElementsByName('p1')[0]; names.innerHTML = 'this is name selector'; </script> </body> </html>