.getElementsByClassName wont work
getElementsByClassName() - Returns a node list containing all elements with a specified class (www.w3schools.com/htmldom/dom_methods)
var x = document.getElementsByClassName("demo");
x.innerHTML = y;
Last edited by Padonak; 04-27-2013 at 03:18 PM.
but i don't understand why you need the  ?
getElementsByClassName() - Returns a node list containing all elements with a specified class
the node list mentioned above is an array. this array consists of only one element, but it is still an array, that's why to get the first element of this array we call array_name[index]. the index is 0 because array's indexes start from 0. my english is not good but i hope this makes sense
when i try make 2 getelementsbyclassname it wont work
window.onload=newFunction(); must be window.onload=newFunction;
var d = getElementsByClassName("demoff"); must be var d = document.getElementsByClassName("demoff");
Last edited by Padonak; 04-29-2013 at 03:40 PM.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)