www.webdeveloper.com
Results 1 to 4 of 4

Thread: From the "body" to "layer" ?

  1. #1
    Join Date
    Dec 2002
    Location
    Switzerland
    Posts
    146

    From the "body" to "layer" ?

    Hi, actually that prints a background image that follows scrollbar... it works with the "body"... i have a layer and I need it to work in it ? any idea ??? thx


    if (document.all||document.getElementById)
    document.body.style.background="url('back.gif') white center no-repeat fixed"

  2. #2
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    10,413
    Hello,

    You can use document.getElementById('name_of_layer').style.background to do the same thing. Apply the style.overflow="auto" and width and height styles for the layer, and it will have scrollbars.


    [J]ona

  3. #3
    Join Date
    Dec 2002
    Location
    Switzerland
    Posts
    146
    Hi jona, thx for your reply...

    I tried something like this ? but does not work ? :O)... i mstill learning in javascript :O) ! and with document.getElementById it will only work with netscape...

    function backscroll() {
    if (document.getElementById)
    {document.getElementById('scroll2').style.background="url('gif/back_bottom.gif') white center no-repeat fixed";}
    do you have an better idea

  4. #4
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    it will only work with netscape
    It will deffinitely work with IE5, IE6 either... Of course if you have use DIV or SPAN tag layers, not LAYER, which is an only NS tag

    For cross-browser with IE4 use

    PHP Code:
    function backscroll() { 
    if (
    document.getElementById){
    document.getElementById('scroll2').style.background="url('gif/back_bottom.gif') white center no-repeat fixed";
    document.getElementById('scroll2').style.overflow ='auto';
    else if (
    document.all){
    document.all['scroll2'].style.background="url('gif/back_bottom.gif') white center no-repeat fixed";
    document.all['scroll2'].style.overflow ='auto';


    make sure you gave the layer an id, <div id="scroll2"></div>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles