SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2007
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Passing backgrounds.

    If I remove the comment markers the code below assigns the background (one.gif) of 'list' to 'area'. If I put the comment back and assign a background to 'list' using css it will not pass it on to 'area'. Why?
    var Link =
    {
    init: function()
    {
    Link.list = document.getElementById("list");
    Link.area = document.getElementById("area");
    Link.swap();
    },
    swap: function()
    {
    for (var i = 1; i < 8; i++)
    {
    alert(i);
    var link = Link.list.childNodes[i];
    alert(link);
    /*link.style.backgroundImage = "url(one.gif)";*/
    var background = link.style.backgroundImage;
    alert(background);
    link.style.color = "#00FF00";
    Link.source.style.top = Link.source.style.top2;
    Link.area.style.backgroundImage = background;
    i++;
    }
    }
    };

    Core.start(Link);

    In peace Neil

  2. #2
    SitePoint Enthusiast
    Join Date
    Sep 2007
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    sorted

    Found another way round it


Bookmarks

Posting Permissions

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