GetElementsByClassName(tagArray, ClassNameArray)
Jan 18, 2006
usage:
var t = new Array('a','span','font');
var tc = new Array('className1','className2')
var arr = getElementsByClassName(t,tc);
function:
function getElementsByClassName(T,TC){
var c=0; var rs = new Array();
for(i=0;i<T.length;i++){
for(j=0;j<TC.length;j++){
var tOBJ = document.getElementsByTagName(T[i]);
for(h=0;h<tOBJ.length;h++){
if(tOBJ[h].getAttribute('class') == TC[j]){
rs[c]=tOBJ[h];
c++;
}
}
}
}
return rs;
}
View 4 Replies
May 20, 2011
i can't seem to get the getElementsByClassName function to work on IE. I don't know why.
There is no error on IE. I've tried with IE Tester and i get this error:
Object doesn't support this property or method
Additional Note: This works on Firefox and Chrome
Code JavaScript:
function getElementsByClassName(className) {// Get a list of all elements in the document
// For IE
if (document.all) {
[Code]......
View 1 Replies
View Related
Apr 17, 2011
I can't get GetElementsByClassName to work.Clicking on the first button moves data to a second function that when clicked moves the data to the input field.This codes works when I change getElementsByName('pics')to getElementById('upload').But I need it to work with getElementsByName().
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>[code]....
View 2 Replies
View Related
Aug 20, 2005
I'm trying to implement getElementsByClass() for the document object
and the Element interface, that supposed to work for HTML, XHTML, SVG
and MathML class attributes (including mixed namespace documents) and I
have it working perfectly in Gecko (tested in Firefox 1.0.6 and Deer
Park Alpha 2). I'm just having some serious problems with IE and a bug
in Opera.
The test [1] is supposed to get a NodeList (an Array() with an item()
method added) of elements by class name and then output an alert()
containing the tagNames of the selected elements.
After a fair bit of testing, I believe the problem is occuring with the
way I'm trying to attach the getElementsByClassName() and hasClassName()
functions to elements in IE using an HTC. It seems to be breaking at
the point within document.getElementsByClassName() where I call
element.hasClassName (line 34 of the script [2]) but my understanding of
this workaround using HTCs [3]] that I'm trying to use is very limited
and I don't understand why it's breaking. Code:
View 2 Replies
View Related
Apr 24, 2009
This does not work. Not sure what I am missing. Basically I want to toggle the none/block value in the style on the span class below based on the browser detection script.
[Code]...
View 6 Replies
View Related
Oct 6, 2008
I can't get getElementsByClassName to work in Internet Explorer.What I want to do is open external links in a new window without using the target attribute (because the site is XHTML Strict) nor inline Javascript.I've given the external links the class name "external":
Code:
<a href="http://webdeveloper.com/" class="external">...</a>
I then wrote the following function, which works in all browsers (Mozilla Firefox, Opera, Google Chrome, Safari) except Internet Explorer:
Code:
window.onload = function() {
external=document.getElementsByClassName('external');
for (var i=0;i<external.length;i++) external[i].onclick=function() {
[code]....
How can I get this to work in Internet Explorer too?Or which other function can do what I want in Internet Explorer?
View 14 Replies
View Related
Feb 6, 2010
I have a class 'main_container' In CSS, i have defined width for the class
.main_container
{
width: 900px;
...
}
When i do:
[Code]...
View 8 Replies
View Related
Oct 29, 2010
I want to use getElementsByClassName in Internet explorer, well it doesn't support it.
View 4 Replies
View Related
Jun 2, 2011
im on a really tight deadline with this and have been strugglign all day. (i know nothing about JS!) here's my code:
<script language="Javascript">
var allHTMLTags = new Array();
function fadeIn(SRC) {
var allHTMLTags=document.getElementsByTagName("*");
for (i=0; i<allHTMLTags.length; i++) {
if (allHTMLTags[i].className.indexOf(",") !== -1)
[Code]...
the end result needs to go through and find all divs with a class CONTAINING the term specified in the <li> then give them an opacity of 1, then on mouseOut return the opacity to 0.5
View 10 Replies
View Related