What have I done wrong here?

Giganews Newsgroups
Subject: What have I done wrong here?
Posted by:  News (warr…@no_S_P_A_M_wyght.com)
Date: Thu, 26 Jan 2006

I have two functions both work in Firefox and Netscape but only one works in
IE. Both are working on different <DIV> tags. My CSS is an external file, I
linked it to the html file.

CSS/* set the width and height of each DIV the JavaScript will change them
later*/
div.a
{
width: 1%;
background-color:  #9900FF;
height: 5%;
}
div.b
{
width: 100%;
background-color: #95F209;
height: 1%;
}

JavaScript /*the functions are to change the width or height of the DIV. */

function doWidth()
{
  var Wdiv = document.getElementById("width");    //capture the correct
element
    Wdiv.style.width = forWidth+'%';                      //set a NEW width
  if(forWidth++ > 99)                                            //reSet
forWidth if required
    forWidth = 0;
  setTimeout("doWidth();",10);                              //recursive (I
think anyway)
}

function doHeight()
{
  var Hdiv = document.getElementById("height");
    Hdiv.style.height = forHeight+'%';
  if(forHeight++ > 10)
    forHeight = 0;
  setTimeout("doHeight();",10);
}

HTML<!-- in Netscape and Firefox both above functions mess with the width
and height of the
                  DIV that are suppose to mess with. In IE nothing happens,
meaning the width or height
                  are not affected-->

<div  id=width class="b">&nbsp;</div>
<BR>
<div id=height class="a">&nbsp;</div>

can someone point out my mistake here?

Replies