Netscape DHTML not working

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Catherine Lynn Smith

    #1

    Netscape DHTML not working

    OK, I know this issue has been beat to death, but I have tested my
    script in Netscape 7.1 and it does seem to be getting the calculated
    values it needs to create placement coordinates, and every example I
    can find that 'works' in my netscape browser "appears" to use the same
    style references to the various div objects that I am trying to use.
    Yet even though I have verified the script is stepping through the
    doResize subroutine, and the values are valid, nothing on my page gets
    moved.

    It works just great in IE6 but even with some cross browser
    incompatibility , I would still expect that at least 'something' would
    be modified in the netscape version but nuttin! What am I missing?
    (and yes, I have compared my DOCTYPE definitions to those of
    'functional' pages too)

    // here's a sample of my js code to resize various div elements on my
    page

    // retreive an object including cross-browser support
    function getObj(name) {
    if (document.getEl ementById) {
    if(document.get ElementById(nam e)) {
    this.obj = document.getEle mentById(name);
    }
    } else if (document.all) {
    if(document.get ElementById(nam e)) {
    this.obj = document.all[name];
    }
    } else if (document.layer s) {
    if(document.lay ers[name]) {
    this.obj = document.layers[name];
    alert(name+" width:"+documen t.layers[name].width);
    }
    }
    return this.obj;
    }
    // handle dynamic resizing of the various layers making up the page
    framework
    function doResize() {
    // allBodyObj = new getObj('allBody ');
    olArcTopObj = new getObj('olArcTo pDiv');
    olArcTilObj = new getObj('olArcTi lDiv');
    olArcBotObj = new getObj('olArcBo tDiv');

    orArcObj = new getObj('orArcDi v');
    orArcTopObj = new getObj('orArcTo pDiv');
    orArcTilObj = new getObj('orArcTi lDiv');
    orArcBotObj = new getObj('orArcBo tDiv');


    tlBlueObj = new getObj('tlBlueD iv');
    ilArcTopObj = new getObj('ilArcTo pDiv');
    ilArcTilObj = new getObj('ilArcTi lDiv');
    ilArcBotObj = new getObj('ilArcBo tDiv');
    blBlueObj = new getObj('blBlueD iv');

    trBlueObj = new getObj('trBlueD iv');
    irArcObj = new getObj('irArcDi v');
    irArcTopObj = new getObj('irArcTo pDiv');
    irArcTilObj = new getObj('irArcTi lDiv');
    irArcBotObj = new getObj('irArcBo tDiv');
    brBlueObj = new getObj('brBlueD iv');

    orightNavObj = new getObj('orightN av');

    centContObj = new getObj('centCon t');

    var xwid = document.body.c lientWidth;
    var yhig = document.body.c lientHeight;

    // pad x and y values for testing by border sizes
    var padX = ilArcTilObj.off setWidth + irArcTilObj.off setWidth;
    var padY = tlBlueObj.offse tHeight + blBlueObj.offse tHeight;

    if(xwid < (cM.curX + padX)) { xwid = cM.curX + padX; }
    if(yhig < (cM.curY + padY)) { yhig = cM.curY + padY; }

    //if(is_nav) {
    //} else {
    // adjust outer arc X & Y axis
    olArcTilObj.sty le.height = yhig - (olArcBotObj.of fsetHeight +
    olArcTopObj.off setHeight); // stretch or contract outer left arc
    elastic middle on y-axis
    olArcBotObj.sty le.top = yhig - (olArcBotObj.of fsetHeight +
    tlBlueObj.offse tHeight); // move outer left arc bottom up or down
    orArcTilObj.sty le.height = yhig - (orArcBotObj.of fsetHeight +
    orArcTopObj.off setHeight + brBlueObj.offse tHeight); // stretch or
    contract outer right arc elastic middle on y-axis
    orArcBotObj.sty le.top = yhig - (orArcBotObj.of fsetHeight +
    brBlueObj.offse tHeight); // move outer right arc bottom up or down
    orArcObj.style. left = xwid - orArcObj.offset Width; // move entire
    outer right arc left or right

    // adjust X-axis values
    blBlueObj.style .width = xwid - brBlueObj.offse tWidth; // stretch or
    contract bottom left blue box on x-axis
    trBlueObj.style .width = xwid - tlBlueObj.offse tWidth; // stretch or
    contract top right blue box on x-axis
    centContObj.sty le.width = xwid - padX; // adjust width of center
    content frame
    irArcObj.style. left = xwid - irArcObj.offset Width; // move inner
    right arc left or right
    brBlueObj.style .left = xwid - brBlueObj.offse tWidth; // move bottom
    right blue gradient left or right

    // adjust Y-axis values
    ilArcTilObj.sty le.height = yhig - (ilArcBotObj.of fsetHeight +
    ilArcTopObj.off setHeight); // stretch or contract inner right arc
    elastic middle on y-axis
    ilArcBotObj.sty le.top = yhig - ilArcBotObj.off setHeight; // move
    inner left arc bottom up or down
    blBlueObj.style .top = yhig - blBlueObj.offse tHeight; // move
    bottom left blue box up or down
    centContObj.sty le.height = yhig - padY; // adjust height of center
    content frame
    irArcTilObj.sty le.height = yhig - (irArcBotObj.of fsetHeight +
    irArcTopObj.off setHeight); // stretch or contract inner right arc
    elastic middle on y-axis
    irArcBotObj.sty le.top = yhig - irArcBotObj.off setHeight; // move
    inner right arc bottom up or down
    brBlueObj.style .top = yhig - brBlueObj.offse tHeight; // move
    bottom right gradient up or down

    // outer right nav should be offset from bottom right
    orightNavObj.st yle.left = xwid - 220; // move outer right nav bar
    left or right
    orightNavObj.st yle.top = yhig - 300; // move outer right nav bar up
    or down
    //}
    }
  • Martin Honnen

    #2
    Re: Netscape DHTML not working



    Catherine Lynn Smith wrote:
    [color=blue]
    > OK, I know this issue has been beat to death, but I have tested my
    > script in Netscape 7.1 and it does seem to be getting the calculated
    > values it needs to create placement coordinates, and every example I
    > can find that 'works' in my netscape browser "appears" to use the same
    > style references to the various div objects that I am trying to use.
    > Yet even though I have verified the script is stepping through the
    > doResize subroutine, and the values are valid, nothing on my page gets
    > moved.
    >
    > It works just great in IE6 but even with some cross browser
    > incompatibility , I would still expect that at least 'something' would
    > be modified in the netscape version but nuttin! What am I missing?
    > (and yes, I have compared my DOCTYPE definitions to those of
    > 'functional' pages too)[/color]

    [color=blue]
    >
    > var xwid = document.body.c lientWidth;
    > var yhig = document.body.c lientHeight;[/color]

    While later versions of Netscape implement clientWidth/clientHeight you
    should use
    window.innerWid th
    window.innerHei ght
    if you want your script to work with all versions of Netscape 4, 6, 7
    [color=blue]
    > olArcTilObj.sty le.height = yhig - (olArcBotObj.of fsetHeight +
    > olArcTopObj.off setHeight); // stretch or contract outer left arc
    > elastic middle on y-axis
    > olArcBotObj.sty le.top = yhig - (olArcBotObj.of fsetHeight +
    > tlBlueObj.offse tHeight); // move outer left arc bottom up or down[/color]

    CSS properties like height or left or top need a number plus a unit e.g.
    in a stylesheet you use
    height: 200px;
    left: 10px;
    and if you use script you need to do the same so you need to add units
    to all those assignments e.g.
    olArcTilObj.sty le.height =
    yhig - (olArcBotObj.of fsetHeight + olArcTopObj.off setHeight) + 'px';

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/

    Comment

    Working...