Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Sep 2002
    Location
    Detroit, Michigan, USA
    Posts
    92
    Thanks
    0
    Thanked 0 Times in 0 Posts

    On DOM and Javascript

    I'm attemtping to create a colored division on a web page by means of the enclosed function. Can someone tell me why it doesn't work? (IE6).

    function addDiv()
    {
    var division=document.createElement('div');
    division.setAttribute('id','divdiv');
    division.setAttribute('class','ccc');
    document.body.appendChild(division);


    var ff=document.getElementById('divdiv');
    ff.style.position=absolute;
    ff.style.top=100px;
    ff.style.left=100px;
    ff.style.width=100px;
    ff.style.height=100px;

    }


    Thanks in advance.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: On DOM and Javascript

    Try quoting your strings:

    <code>ff.style.position="absolute";
    ff.style.top="100px";
    ff.style.left="100px";
    ff.style.width="100px";
    ff.style.height="100px";</code>

  3. #3
    Star Lounger
    Join Date
    Sep 2002
    Location
    Detroit, Michigan, USA
    Posts
    92
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: On DOM and Javascript

    Sure did it.....thanks again, good call.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •