Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to style dynamically created elements in IE

Status
Not open for further replies.

jaschulz

Programmer
May 20, 2005
89
0
0
FR
I have posted an example page at:


that shows a problem with the way IE7 handles (or rather, refuses to handle) styles applied to dynamically created elements. The page loads perfectly in FF2, Safari 3 and Opera 9, but I cannot find anyway to get IE7 to do it right (a very old story, I know).

Any ideas?

Thanks,

JAS
 
OK, that fixed the problem in Div1. (And I have updated the example file at: to show that.) Thank you very much.

However, (and I am sorry to seem greedy) I need the dom technique (in Div2) to work as well if that is possible. The problem there seems to be only with the cssFloat style. Is there some way to persuade IE to apply that style correctly?

JAS
 
Neither IE6 nor IE7 support the "cssFloat" property. They both use "styleFloat" instead:


So something like this should work:

Code:
if (newBDiv.style.styleFloat) {
	newBDiv.style.styleFloat = 'left';
} else {
	newBDiv.style.cssFloat = 'left';
}

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Not quite "putting it another way" because the second way works whereas the first one doesn't.

Thanks very much,

JAS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top