473,387 Members | 1,578 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,387 software developers and data experts.

IE not rendering class styles for dynamically created elements

32
Hello,

I was working on an Ajax-based page when I came across a little problem with IE7. If I create a page element in JavaScript and give it a class (to be styled of course) IE7 does not style the element properly once its added to the page.

Case in point, I've created a validated test page, http://dev.akeenlabs.com/test_addData.html , that demonstrates what I'm talking about.

Could someone please help me find a work around and/or tell me what I'm doing wrong in creating these objects.

Thanks.
Mar 28 '08 #1
3 2297
drhowarddrfine
7,435 Expert 4TB
iirc, there are issues with dynamically set styles and when they are to be changed or set. This is a javascript problem so I'm transferring it there.
Mar 28 '08 #2
pronerd
392 Expert 256MB
You want to set the attribute 'className' not class.

So the line
Expand|Select|Wrap|Line Numbers
  1. newDiv.setAttribute('class', 'newDiv');
Should be

Expand|Select|Wrap|Line Numbers
  1. newDiv.className='newDiv';
Mar 28 '08 #3
poe
32
You want to set the attribute 'className' not class.

So the line
Expand|Select|Wrap|Line Numbers
  1. newDiv.setAttribute('class', 'newDiv');
Should be

Expand|Select|Wrap|Line Numbers
  1. newDiv.className='newDiv';
Thanks, that fixed it.
Mar 28 '08 #4

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

Similar topics

0
by: manju | last post by:
Hi, I use DHTML browser as my main application window and I create elements like <p>, <table>, <img> etc dynamically using MSHTML C++ interfaces like IHTMLDocument2::createElement...
1
by: CS Wong | last post by:
Hi, I have a page form where form elements are created dynamically using Javascript instead of programatically at the code-behind level. I have problems accessing the dynamically-created...
10
by: Jason Pettys | last post by:
I have an ASP.NET page that my client wants to e-mail. So in IE we choose File > Send > Page by E-mail, which opens up either Outlook or Outlook Express with the HTML page content as the message...
2
by: luke.crouch | last post by:
My server-side php script is generating an xml response with the following structure: <thread class='Columns'> <Id class='Column dataDetail'>12345</Id> <Command class='Column...
5
by: paul.hester | last post by:
Hi all, I have a custom control with an overridden Render method. Inside this method I'm rendering each control in its collection using their RenderControl method. However, I'm running into a...
1
by: JackBlack | last post by:
Hi, all! Using Win2k3 Server & IE 6 (all patches) on one box (web server), and XP/Pro & IE7 on another (workstation)... Project is a basic on-screen calendar with dynamically created table rows...
3
by: brian.turner | last post by:
This is sort of a design/javascript question. It involves CSS rendering in dynamic areas of a page using IE. E 6 & 7 HI There, We've created some example static html pages (using CSS) that...
1
by: rirby2 | last post by:
Hi everyone, I'm currently having a rendering problem in IE7 (haven't even tried the lower IEs yet), vs. what I see in FF2. The simplified site can be found at solerasd.com . (There are more...
4
Frinavale
by: Frinavale | last post by:
So a while ago I created a Tab Strip Control (before the AjaxToolkit had theirs otherwise I would have probably just used theirs). When I looked at the AjaxToolkit control to see how they got...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...

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.