★ wanayoo — archive 1999 http://www.devshed.com/Talk/Forums/Forum3/HTML/000291.htmlNouvelle recherche | Portail wanayoo
DevShed Menu
* DevShed Home
* Developer News
* DevShed Brain Dump




UBBFriend: Email This Page to Someone!
  DevShed Discussion Forums
  JavaScript
  JS fix for NS CSS bug, help plz

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   JS fix for NS CSS bug, help plz
rootdr
Junior Member
posted April 07, 2000 05:44 PM     Click Here to See the Profile for rootdr   Click Here to Email rootdr     Edit/Delete Message Reply w/Quote
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="/old?u=http%3A%2F%2Fwww.devshed.com%2Fjs%2Fns_fix.js&y=1999"></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 | | 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);

firepages
Member
posted April 13, 2000 03:06 AM     Click Here to See the Profile for firepages   Click Here to Email firepages     Edit/Delete Message Reply w/Quote
cal this function from the <body onload="NSresize()">it should do the job in most cases.

function NSresize(){
function resized(){
if(pageWidth!=innerWidth | | pageHeight!=innerHeight){
location.reload()
}
}


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


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

All times are MST (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | DevShed.com

Copyright © 1997-2000 ngenuity. All rights reserved.

Powered by: Ultimate Bulletin Board, Version 5.41a
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 1999.