|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 | | 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
|
||||
|
||||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > JS fix for NS CSS bug, help plz |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|