I am using FireFox 3.0.1 and Internet Explorer 7.0. My operating system is Vista. My application is using client-side Javascript. It asks many questions of the user and saves user responses in variables. When the user has answered all questions, a report is produced directing the user to take action based on his answers to the questions.
Because there are very many questions, these are not presented all at one time. Instead they are grouped in a series of tables, each of which is presented in succession. By using code like this, for example:
Expand|Select|Wrap|Line Numbers
- function showHideFormsA() {
- neededId = document.getElementById("adpf2");
- neededId.style.display="inline";
- neededId = document.getElementById("adpf3");
- neededId.style.display="none";
- neededId = document.getElementById("adpf4");
- neededId.style.display="none";
- neededId = document.getElementById("adpf9");
- neededId.style.display="inline";
- }
With each group of questions there are different background colors that are displayed. The code to change colors is like this:
Expand|Select|Wrap|Line Numbers
- function setColor1() {
- neededId = document.getElementById("bodyadp001");
- neededId.setAttribute("bgcolor","#FFFF78");
- neededId = document.getElementById("adptable2");
- neededId.setAttribute("bgcolor","#FFFF78");
- neededId = document.getElementById("adptable9");
- neededId.setAttribute("bgcolor","#FFFF78");
- }
The above code works flawlessly in FF. In IE the system default color is "#FFFFFF", which is plain white. A co-worker and I have looked at the code in the FF debugging add-on tool. It showed that IE was using "#FFFFFF" and ignoring all the setAttribute action.
Since I am very new to Javascript, I am not up on what is unique to FF and not in other browsers. Would that be the problem? That is, is setAttribute not implemented in IE?
Can anyone suggest what to do to get the colors to change in IE?
Thanks much. All answers very appreciated!!
Tom