#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Posts
    8
    Rep Power
    0
    Hi,

    If there are any JS gurus here, I would REALLY appreciate their help in slimming down some JS that is produced by GolIve 4.0. I need this Netscape fix since I am using CSS that are subject to the resize bug in Netscape. If someone resizes their browser window at my site, the CSS styles are thrown out the window. It seems there is a bug in the JS code. On resizing Netscape windows, with the GoLive created JS inline or externally referenced to a .js file, the page reloads itself TWICE. If you quickly manage to see the page after the first reload, you can see that the second reload is not necessary.

    I believe I have removed what could be considered as extraneous code and have made the listing below into an external JS file that is referenced with: <script language="JavaScript" src="/js/ns_fix.js"></script>. Within the <body> I have also added: onLoad="CSScriptInit();

    There must be somebody who can solve this problem that I believe will slim down the code generated by GL's NS fix action for EVEYBODY's benefit.

    Many thanks.

    rootdr
    --
    "External JS file: ns_fix.js"

    CSStopExecution = false;
    CSInit = new Array;
    function CSScriptInit() {
    if(typeof(skipPage) != "undefined") { if(skipPage) return; }
    idxArray = new Array;
    for(var i=0;i<CSInit.length;i++)
    idxArray[i] = i;
    CSAction2(CSInit, idxArray);
    }
    CSStopExecution = false;

    function CSAction(array) {
    return CSAction2(CSAct, array);
    }
    function CSAction2(fct, array) {
    var result;
    for (var i=0;i<array.length;i++) {
    if(CSStopExecution) return false;
    var actArray = fct[array[i]];
    if(actArray == null) return false;

    var tempArray = new Array;
    for(var j=1;j<actArray.length;j++) {
    if((actArray[j] != null) && (typeof(actArray[j]) == "object") && (actArray[j].length == 2)) {
    if(actArray[j][0] == "VAR") {
    tempArray[j] = CSStateArray[actArray[j][1]];
    }
    else {
    if(actArray[j][0] == "ACT") {
    tempArray[j] = CSAction(new Array(new String(actArray[j][1])));
    }
    else
    tempArray[j] = actArray[j];
    }
    }
    else
    tempArray[j] = actArray[j];
    }
    result = actArray[0](tempArray);
    }
    return result;
    }
    CSAct = new Object;
    function CSFixFct() {
    var d = document; var w = window;
    if (d.cs.csFix.w != w.innerWidth &#0124; &#0124; d.cs.csFix.h != w.innerHeight) {
    d.location = d.location; }
    }
    function CSNSFix(action) {
    var d = document; var w = window;
    if ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) == 4)) {
    if (typeof d.cs == 'undefined') {
    d.cs = new Object;
    d.cs.csFix = new Object;
    } else if (CSIsFrame (w) == true) CSFixFct();
    d.cs.csFix.w = w.innerWidth;
    d.cs.csFix.h = w.innerHeight;
    window.onresize = CSFixFct;
    }
    }
    function CSIsFrame (window) {
    var rootWindow = window.parent;
    if (rootWindow == 'undefined') return false;
    for (i = 0; i < rootWindow.frames.length; i++)
    if (window == rootWindow.frames[i]) return true;
    return false;
    }

    CSInit[CSInit.length] = new Array(CSNSFix);
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    Perth West Australia
    Posts
    757
    Rep Power
    15
    cal this function from the <body onload="NSresize()">it should do the job in most cases.

    function NSresize(){
    function resized(){
    if(pageWidth!=innerWidth &#0124; &#0124; pageHeight!=innerHeight){
    location.reload()
    }
    }


    if(document.layers){
    pageWidth=innerWidth
    pageHeight=innerHeight
    window.onresize=resized
    }
    }




    ------------------
    Simon Wheeler
    FirePages -DHTML/PHP/MySQL

Similar Threads

  1. CSS padding bug
    By kcocgibkcusuoy in forum CSS Help
    Replies: 0
    Last Post: January 31st, 2004, 03:52 PM
  2. Bug... anyone have a ideia o fix it
    By gmalta in forum HTML Programming
    Replies: 0
    Last Post: February 20th, 2003, 09:29 AM
  3. Problem with css mouse-over (maybe javascript fix?)
    By blissdev in forum JavaScript Development
    Replies: 5
    Last Post: January 4th, 2003, 04:29 PM
  4. How do I fix how this CSS looks in IE6?
    By Statik in forum CSS Help
    Replies: 3
    Last Post: March 30th, 2002, 09:29 AM
  5. css crazy weridness - plz help
    By Baphomay in forum CSS Help
    Replies: 5
    Last Post: January 21st, 2002, 10:14 PM

IMN logo majestic logo threadwatch logo seochat tools logo