Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Important DOM methods to get the document/doc_parts
- var myVar = documnet.getElementsByClassName("content"); // returns an array of elements that has the class name "content"
- var myTag = myVar[1].getElementBsyTagName("h2"); // returns an array of elements that has the class name the tag name "h2"
- //can be done further operation with these returned objects, such as...
- myTag[0].innerHTML("what u want to change"); // should show the changes in the node/tag
- var myId = myTag[0].getElementById("page-title"); //NOT elements such above
- Important DOM properties and methods to change the document/doc_parts
- var content = document.getElementById("id");
- content.textContent; //gives the textcontents of the given id or
- content.textContent = "I should appear";
- var link = content.getAttribute("href"); //"href" the attribute u want to call
- link.href // give the links that refers
- content.setAttribute("href", "pi"); // replacing or adding new attributes
- title.style.left = 10px; // can be accessed to the css directly
- var name = document.createElement("name");
- menu.appendNewChild(name);
- // can be added/removed(removeChild()) and so on
- title.onclick = function(){};
Add Comment
Please, Sign In to add comment