I tried your advise using this code:
First function $() is an alias for getElementByID, second function searches the DOM tree for elements with proper className.
At the end of code i'm trying to get elements with class "EventDiv" but it's not working.
function $() { var elements = new Array(); for (var i = 0; i < arguments.length; i++) { var element = arguments[i]; if (typeof element == 'string') { if (document.getElementById) { element = document.getElementById(element); } else if (document.all) { element = document.all[element]; } } elements.push(element); } if (arguments.length == 1 && elements.length > 0) { return elements[0]; } else { return elements; }}function getElementsByClassName(className, tag, elm){ var testClass = new RegExp("(^|\\s)" + className + "(\\s|$)"); var tag = tag || "*"; var elm = elm || document; var elements = (tag == "*" && elm.all)? elm.all : elm.getElementsByTagName(tag); var returnElements = []; var current; var length = elements.length; for(var i=0; i<length; i++){ current = elements[i]; if(testClass.test(current.className)){ returnElements.push(current); } } return returnElements;}
var EventDivs = getElementsByClassName('EventDiv','div',$('main.document'));var myText = 'this is alert:' + EventDivs[0].style.top;
In Firebug tool (for FF) i get the error:
To use the full functionality of this web site, JavaScript needs to be turned on.
For best results, use the Firefox browser..
Copyright © 2003-2017 - Tersus Software Ltd., All rights reserved. Terms of Use License Graphic design by EmaraDesign