473,480 Members | 1,884 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

getElementsByName doesn't seem to work in IE

banning
42 New Member
ok im sick and tired of browser compatibility, i had a question a while ago and someone was kind enough to help me out and figure out my solution and it worked... course i use the ever amazing firefox and of course it worked... unfortunately in my hast i forgot to check IE and the code for the vertClicker doenst appear to work in IE. i dont know if i have posted enough of the code or not but i hope you guys are able to help ... thanks in advance

Expand|Select|Wrap|Line Numbers
  1.  
  2. //THIS DOESNT WORK
  3. var vertClicker=0;
  4. function vertColor(id){
  5.     var tds = document.getElementsByName(id);
  6.     for(var i = 0; i < tds.length; ++i )
  7.     {
  8.         if(vertClicker==0 && tds[i].style.backgroundColor=='' || vertClicker==1 && tds[i].style.backgroundColor==''){
  9.             vertClicker=1;
  10.         }else if(vertClicker==0 && tds[i].style.backgroundColor!='' || vertClicker==1 && tds[i].style.backgroundColor!=''){
  11.             vertClicker=0;
  12.         }
  13.         if (vertClicker==1){
  14.             tds[i].style.backgroundColor='#66FFCC';
  15.         }else{
  16.             tds[i].style.backgroundColor='';
  17.         }
  18.     }
  19. }
  20.  
  21. //THIS WORKS
  22. var horzClicker=0;
  23. function horzColor(horzClick){
  24.     if(horzClicker==0 && document.getElementById(horzClick).style.backgroundColor=='' || horzClicker==1 && document.getElementById(horzClick).style.backgroundColor==''){
  25.         horzClicker=1;
  26.     }else if(horzClicker==0 && document.getElementById(horzClick).style.backgroundColor!='' || horzClicker==1 && document.getElementById(horzClick).style.backgroundColor!=''){
  27.         horzClicker=0;
  28.     }
  29.     if (horzClicker==1){
  30.         document.getElementById(horzClick).style.backgroundColor='#B7EFFF';
  31.     }else{
  32.         document.getElementById(horzClick).style.backgroundColor='';
  33.     }
  34. }
  35.  
Sep 5 '07 #1
1 699
acoder
16,027 Recognized Expert Moderator MVP
Moved from the Articles section.

Changed the thread title too.
Sep 5 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
3671
by: simon | last post by:
<html> <head> <script language="vbscript"> sub window_onload msgbox document.getElementsByName("name1").length end sub </script> </head> <body> <div name="name1">testDiv</div>
21
11335
by: briggs | last post by:
<html> <head> <script> /* AddChild */ function ac() { var c; var p = document.getElementById("p"); for (var i = 0; i < 5; i++) { c = document.createElement("DIV"); // Create 'div' element.
2
5655
by: André Wagner | last post by:
I'm trying to get all the "divs" that have a given NAME using getElementsByName(). For example, the following code: <html> <head> <script type="text/javascript"> function on_load() { var...
22
7913
by: Saul | last post by:
I have a set of radio buttons that are created dynamically, after rendered I try loop thru this set by getting the length of the set, but I keep getting an error stating the element is undefined. I...
4
21528
by: Otto Wyss | last post by:
I've tried to access the value of a selected option through the following getSelectValue function, passing the name of the select function getSelectValue (name) { var sel =...
2
2669
by: tsalm | last post by:
Hi everybody, I need to get a element create dynamically by its name. It's ok for FF, but on IE, getElementsByName return "undefined". I create this code but not sure that it can work on older...
2
23228
by: zephyr | last post by:
Hi, I have a hidden field in my form: <input type="hidden" name="checkBoxesCollection" value=""> If I submit the form I call a javascript function: function storeCheckboxFieldNames(theForm){...
1
2941
by: Sebarry | last post by:
Hi, Can anyone tell me how to use getElementsByName to retrieve the length of a HTML select input type? I've tried document.getElementsByName("selectName").options.length but it doesn't work. ...
5
1325
banning
by: banning | last post by:
ok im sick and tired of browser compatibility, i had a question a while ago and someone was kind enough to help me out and figure out my solution and it worked... course i use the ever amazing...
2
4961
Frinavale
by: Frinavale | last post by:
I'm attempting to intercept the click event for RadioButons in an attempt to ask the user for confirmation of their action. I determined that Internet Explorer does not reset the previous...
0
7051
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6915
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
6993
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5353
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4493
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2993
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1307
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
567
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.