473,395 Members | 1,701 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

IE DOM bug for setAttribute - my workaround doesn't work!

12
Hello,

I am using javascript to dynamically add some rows to a form. I know that IE has a problem with certain DOM stuff. (e.g. needs className instead of class)

I am trying to set the alignment of a checkbox element in a cell to center. I found in a forum that IE uses "middle" instead of "center" (?why?) so I tried the following code. But although my cell is fine in mozilla, the box still appears on the left of the cell in IE.

Expand|Select|Wrap|Line Numbers
  1. // Workaround for  IE bug
  2.     if ((document.all) && (document.getElementById))
  3.     {
  4.     // for IE
  5.         tableCell2.setAttribute('align', 'middle');
  6.     }
  7.     else
  8.     {
  9.         tableCell2.setAttribute('align', 'center');
  10.     }
  11.  
Any ideas why this doesn't work ? Any good ideas for getting around this problem much appreciated !
Oct 11 '07 #1
1 1501
iam_clint
1,208 Expert 1GB
IE uses center for left and right alignment and middle for top to bottom alignment. (most browsers do). Now thats out of the question. I can show you a way to work around it but it depends on how its being used.. are you creating these cells via DOM (createElement("TD")) or just grabbing that cell by getElementById() or any other get method.
Nov 5 '07 #2

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

Similar topics

3
by: timmy_dale12 | last post by:
Hello , im a java programmer whos gotten tangled up in some javascripts. Im really stuck on this one can , can aybody explain this to me. I have a javscript which is to clone a table row and...
6
by: Pugi! | last post by:
I use mycurrent_cell.setAttribute("style", "background-color:green"); and mycurrent_cell.setAttribute("colspan", "3"); to set some attributes of a table. The code works perfect in FireFox and...
5
by: gkelly | last post by:
Can someone explain what I am doing wrong, or why this will not work? I've tested this in IE6, Firefox 1.5 and Mozilla 1.7, all with the same result. Take for example this code: <html>...
4
by: jvanulden | last post by:
Hello all, I am having difficulty figuring out how to create an XmlElement and giving it an attribute that requires a namespace. Here is what I have so far which throws an exception because you...
11
by: jesdynf | last post by:
I'm having trouble applying a stylesheet to content I'm generating after the fact. Here's the sample code: <html> <head> <title>CSS/DOM Problem Example</title> <style type="text/css">...
2
by: Craig Taylor | last post by:
I've seen other referances to this bug in IE when researching the problem but haven't seen any solutions. Apparently IE does not honor setAttribute of colspan when building a table. Does anyone...
2
by: Wolfing | last post by:
I have a piece of jscript that used to work fine, but seems to be problematic in IE7: I have an iframe that I want to turn scrolling off. The section of code is: .... iframeElement =...
2
by: nygiantswin2005 | last post by:
Hi I have wrote a method in my C# class with the following code, to create an XMl file. The root element is suppose to have 3 attibutes. I can not get attributes to appear correctly. ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.