View Full Version : Resolved Works in FF but not IE

01-22-2009, 07:52 AM
Sorry about the title cause I know there must be hundreds of these but I truly am lost hence the title.

I am trying to create an online demonstration/builder of how to create a pure CSS 3 column layout. Problem is that the builder portion of the demonstration throws a error at me in IE and gives some funny results.

Here is the demonstration.

In the header you have a text input that allows you to change the left and right column sizes. In IE you enter in your desired numbers and in fact the sizes do change but you get and error. Also after the error the left column is not properly positioned but if you click the "Add Content" button in any of the columns the new size and left columns position are as desired.

Here is my functions that preform the resizing of the columns.

function changeWidth()
var cssCode = document.getElementById("cssCode");
var htmlCode = document.getElementById("htmlCode");


var wrap = document.getElementById("wrap");
var wrapStyle = wrap.getAttribute("style","width");

var left = document.getElementById("left");
var right = document.getElementById("right");
var center = document.getElementById("center");

function appendCSS()
var width = document.getElementById("columnWidth").value;
var centerWidth = parseFloat(wrapStyle)-parseFloat(width)-parseFloat(width);




var colWidth = parseFloat(width)-25+"px";

if (typeof wrapStyle == 'string') { // what Firefox returns
wrapStyle = wrapStyle.replace(/px/g,"");
wrapStyle = wrapStyle.replace(/width:/g,"");


else if (typeof wrapStyle == 'object') { // what IE returns
wrapStyle = wrapStyle.cssText;
wrapStyle = wrapStyle.replace(/px/g,"");
wrapStyle = wrapStyle.replace(/WIDTH: /g,"");

Any help is appreciated and well credited.

Philip M
01-22-2009, 09:20 AM
Probably the usual IE needing a delay problem. Try this:-

window.setTimeout("appendCSS()", 100);

Quizmaster: What season is said to start on the longest day in December?
Contestant: Spring.
Quizmaster: December, for God's sake!
Contestant: Summer.

01-22-2009, 09:30 AM
Hey Philip M,

That seems to break it even more cause now the value of the input box changes nothing. Still works fine in FF though lol.

Its just weird.

01-23-2009, 02:07 AM
I think it might have something to do with IE and parseFloat that turns strings into an integer. I just dont know what it could be, nothing on the net tells me anything. I mean the whole layout adjusting its prior to your desired width is weird but again that might just be related to an IE timing issue but why the error.


01-23-2009, 03:53 AM
w00t got it to work finally.

Philip M thanks for the lead with the timing issue cause it got me testing a little deeper.

For what ever reason IE didn't like me to set a value for the widths of the columns to be anything less than an integer length of at least 3.

I fixed the align problems with an extra function to add and quickly remove an empty paragraph tag in the right column with of course a time out of 1milisec on the remove. Seem to have kicked IE back into gear.

I love IE and its continuing display of wacky zany fun filled faultiness, its what keep me on a payroll.