Click to See Complete Forum and Search --> : DHTML issues with IE


redijedi
09-10-2003, 01:50 PM
I am trying to produce a table dynamically when the user presses "add to queue". It works great in Mozilla, but it is formatted incorrectly in IE. Here's a link:

http://helios.acomp.usf.edu/~torr2/test/test.php

Specifically, the checkbox is not checked and the css classes don't seem to be working. This only happens in IE and I can't figure it out.

Thanks For any help you can give,
Tom

Fang
09-10-2003, 03:09 PM
I don't think that setting the class is supported in IE.
Here (http://forums.webdeveloper.com/showthread.php?s=&threadid=15452&highlight=class) is a similar problem with a work around.
The checkbox appears to be working in IE6.

redijedi
09-10-2003, 10:56 PM
It seems that the work around will add style to an element selector. Unfortunately I need the class to be applied to only specific elements in the table. I need the row in the queue to be formatted, not every row. Also, what I meant by the checkbox was that it should be checked by default. IE doesn't do this while mozilla does.

Thanks, though

Fang
09-11-2003, 03:36 AM
Looks like browser detection is necessary for class :mad: see this (http://lists.w3.org/Archives/Public/www-dom/2000OctDec/0175.html)

As for the chk.setAttribute("checked", true); have you tried "true" string?
Or chk.checked = true;

redijedi
09-11-2003, 08:26 AM
Yeah, I tried the string "true", I tried "on", I tried "checked". Doesn't seem to work.:(

IE seems to not like to set attributes in general. Its funny because I usually find myself having to work around mozilla, but when it really counts I lose the most heavily installed browser base.:mad:

Thanks

Fang
09-11-2003, 08:49 AM
chk.checked = true; should work.

Any luck with the class?

You may want to try this after an appendChild
if(document.all){obj.innerHTML = obj.innerHTML;}
It's a fix from Khalid for IE, some sort of update of the DOM tree.

IE won't be updating it's browser for possibly another 2 years,
and then it will probably be XHTML2 compliant. Meanwhile Moz. and others are constantly improving, but still loosing their users. It's not always "the best wins".

redijedi
09-11-2003, 09:43 AM
The checkbox still doesn't work. How would I use that work around? I tried it in several places, but it threw out an error. I assumed that I was supposed to change tdiv to whichever element I had just appended to.

Fang
09-11-2003, 10:56 AM
This simple version works:
var oInput = document.createElement('input');
oInput.setAttribute('type', 'checkbox');
beforeObj=document.getElementById("submit");
document.getElementById("myform").insertBefore(oInput, beforeObj);
oInput.checked="true";

redijedi
09-11-2003, 02:13 PM
The only difference, algorithmically, I see is that the checkbox is checked after being inserted into the document. I tried this, and it works! :) Isn't that odd? The only caveat is that I had to remove my attempts at the work around you showed me concerning refreshing the dom. So now I've just got to figure out how to get the class working.

Thanks for your all your help!

Fang
09-11-2003, 04:07 PM
Odd, that's IE for you.
Was the class link (http://lists.w3.org/Archives/Public/www-dom/2000OctDec/0175.html) of any use?