JavaScript Cheet Sheet

2.2 - HTML Objects

Example 1 - This is a Heading

Some text in a (<p>) element

A link to google.

// Various function which get accuated using 'onclick', when the corresponding button is clicked

function getTitle(){
   example1a.innerText = document.title;
}

function getScripts(){
example1b.innerText = document.scripts;
}

function getDomain(){
   example1c.innerText = document.domain;
}

function getCookies(){
example1d.innerText = document.cookies;
}

function getBody(){
example1e.innerText = document.body;
}

function getElement(){
example1f.innerText = document.documentElement;
}

function getID1(){
example1g.innerText = document.getElementById("myHeading");
}

function getID2(){
example1h.innerText = document.getElementById("myParagraph");
}

function getID3(){
example1i.innerText = document.getElementById("aLink");
}
Example 1 Output