Newsgroup: it.comp.lang.javascript
Titolo: HELP my script won't gets stuck in Netscape 4 (not even java error)

Something is wrong with my script. It works on IE and NE3 (it does not
display anything), but as far as NE 4 it does not work, the screen gets
stuck and I have to close NE. If any body can help I'll appreciate it,
Thanks,
Sergio
// All links defined
var purchase1 = "furelise/purchase/index.htm";
var purchase2 = "furelise/purchase/online.htm";
var purchase3 = "furelise/purchase/fax.htm";
var purchase4 = "furelise/purchase/training.htm";
var customer1 = "furelise/clients/index.htm"
var customer2 = "furelise/clients/fe5/index.htm"
var customer3 = "/clients/release.htm"
var customer4 = "file=faq.htm&amp;session"
var customer5 = "furelise/clients/dowload/FE4_hlp.exe"
var customer6 = "furelise/clients/soft-back.htm"
var product1 = "furelise/product/index.htm"
var product2 = "furelise/product/about.htm"
var product3 = "furelise/product/year2000.htm"
var product4 = "furelise/product/develop.htm"
var product5 = "furelise/product/glance.htm"
var product6 = "furelise/product/maintenance.htm"
var product7 = "furelise/product/users.htm"
// All Source Images
var ipurchase1 = "furelise/bar-2.gif";
var ipurchase2 = "furelise/bar-2-1.gif";
var ipurchase3 = "furelise/bar-2-2.gif";
var ipurchase4 = "furelise/bar-2-3.gif";
var icustomer1 = "furelise/bar-3.gif"
var icustomer2 = "furelise/bar-3-1.gif"
var icustomer3 = "furelise/bar-3-1-1.gif"
var icustomer4 = "furelise/bar-3-2.gif"
var icustomer5 = "furelise/bar-3-3.gif"
var icustomer6 = "furelise/bar-3-4.gif"
var iproduct1 = "furelise/bar-1.gif"
var iproduct2 = "furelise/bar-1-1.gif"
var iproduct3 = "furelise/bar-1-2.gif"
var iproduct4 = "furelise/bar-1-3.gif"
var iproduct5 = "furelise/bar-1-4.gif"
var iproduct6 = "furelise/bar-1-5.gif"
var iproduct7 = "furelise/bar-1-6.gif"
// As default the browser does not support layers
var NSLayer_Supported = false;
var Layer_Supported = false;
// Sets the common tags for statements for NS and IE
var layertagopen = "<div id=";
var style = "style='position:absolute; ";
var left = "left:";
var top = "top:";
var width = "width:";
var height = "height:";
var zindex = "z-index:";
var htagopen = "<a href=\'";
var domouse1_1 = "\' onMouseOver=\"MM_showHideLayers(\'document.layers[\\'";
var domouse1_2 = "onMouseOut=\"MM_showHideLayers(\'document.layers[\\'";
var domouse2 = "\\']','document.all[\\'";
var domouse3_1 = "\\']','show')\"";
var domouse3_2 = "\\']','hide')\">";
var htagclose = "</a>";
var layerclose = "</div>";
var iopen = "<img src='";
var iclose = "' border='0'>";
// Finds out which browser is being used
 if (navigator.userAgent.indexOf("MSIE")    != -1 &&
  navigator.appVersion.substring(0,1) > 3)
 {  Layer_Supported = true; }
 if (navigator.appName.indexOf("Netscape")    != -1 &&
  navigator.appVersion.substring(0,1) > 3) {
    NSLayer_Supported = true;
   Layer_Supported = true; }
 if (Layer_Supported)
 {
 // Layer name and settings for purchase
 var layername = "purchase";
 var l = "239px;" , w = "154px;" , h = "70px;" , z = "2; visibility:
hidden'>";
  if (NSLayer_Supported)
   t = "8px;"; }
  else { t= "15px;"}
 document.write (
  layertagopen + "'" + layername + "'" + style + top + t + left + l + width
+ w +  height + h + zindex + z +
     htagopen + purchase1 +
        domouse1_1 + layername + domouse2 + layername + domouse3_1 +
       domouse1_2 + layername + domouse2 + layername + domouse3_2 +
       iopen + ipurchase1 + iclose + htagclose +
     htagopen + purchase2 +
        domouse1_1 + layername + domouse2 + layername + domouse3_1 +
       domouse1_2 + layername + domouse2 + layername + domouse3_2 +
        iopen + ipurchase2 + iclose + htagclose +
     htagopen + purchase3 +
        domouse1_1 + layername + domouse2 + layername + domouse3_1 +
       domouse1_2 + layername + domouse2 + layername + domouse3_2 +
        iopen + ipurchase3 + iclose + htagclose +
     htagopen + purchase4 +
        domouse1_1 + layername + domouse2 + layername + domouse3_1 +
       domouse1_2 + layername + domouse2 + layername + domouse3_2 +
        iopen + ipurchase4 + iclose + htagclose +
  layerclose )
 // Layer name and settings for clients
 var layername = "customer";
 var l = "393px;" , w = "160px;" , h = "89px;" , z = "4; visibility:
hidden'>";
  if (NSLayer_Supported)
   t = "8px;"; }
  else { t= "15px;"}
 document.write (
  layertagopen + "'" + layername + "'" + style + top + t + left + l + width
+ w +  height + h + zindex + z +
     htagopen + customer1 +
        domouse1_1 + layername + domouse2 + layername + domouse3_1 +
       domouse1_2 + layername + domouse2 + layername + domouse3_2 +
       iopen + icustomer1 + iclose + htagclose +
     htagopen + customer2 +
        domouse1_1 + layername + domouse2 + layername + domouse3_1 +
       domouse1_2 + layername + domouse2 + layername + domouse3_2 +
        iopen + icustomer2 + iclose + htagclose +
     htagopen + customer3 +
        domouse1_1 + layername + domouse2 + layername + domouse3_1 +
       domouse1_2 + layername + domouse2 + layername + domouse3_2 +
        iopen + icustomer3 + iclose + htagclose +
     htagopen + customer4 +
        domouse1_1 + layername + domouse2 + layername + domouse3_1 +
       domouse1_2 + layername + domouse2 + layername + domouse3_2 +
        iopen + icustomer4 + iclose + htagclose +
     htagopen + customer5 +
        domouse1_1 + layername + domouse2 + layername + domouse3_1 +
       domouse1_2 + layername + domouse2 + layername + domouse3_2 +
        iopen + icustomer5 + iclose + htagclose +
     htagopen + customer6 +
        domouse1_1 + layername + domouse2 + layername + domouse3_1 +
       domouse1_2 + layername + domouse2 + layername + domouse3_2 +
        iopen + icustomer6 + iclose + htagclose +
  layerclose )
 // Layer name and settings for clients
 var layername = "product";
 var l = "143px;" , w = "136px;" , h = "122px;" , z = "3; visibility:
hidden'>";
  if (NSLayer_Supported)
   t = "8px;"; }
  else { t= "15px;"}
 document.write (
  layertagopen + "'" + layername + "'" + style + top + t + left + l + width
+ w +  height + h + zindex + z +
     htagopen + product1 +
        domouse1_1 + layername + domouse2 + layername + domouse3_1 +
       domouse1_2 + layername + domouse2 + layername + domouse3_2 +
       iopen + iproduct1 + iclose + htagclose +
     htagopen + product2 +
        domouse1_1 + layername + domouse2 + layername + domouse3_1 +
       domouse1_2 + layername + domouse2 + layername + domouse3_2 +
       iopen + iproduct2 + iclose + htagclose +
     htagopen + product3 +
        domouse1_1 + layername + domouse2 + layername + domouse3_1 +
       domouse1_2 + layername + domouse2 + layername + domouse3_2 +
       iopen + iproduct3 + iclose + htagclose +
     htagopen + product4 +
        domouse1_1 + layername + domouse2 + layername + domouse3_1 +
       domouse1_2 + layername + domouse2 + layername + domouse3_2 +
       iopen + iproduct4 + iclose + htagclose +
     htagopen + product5 +
        domouse1_1 + layername + domouse2 + layername + domouse3_1 +
       domouse1_2 + layername + domouse2 + layername + domouse3_2 +
       iopen + iproduct5 + iclose + htagclose +
     htagopen + product6 +
        domouse1_1 + layername + domouse2 + layername + domouse3_1 +
       domouse1_2 + layername + domouse2 + layername + domouse3_2 +
       iopen + iproduct6 + iclose + htagclose +
     htagopen + product7 +
        domouse1_1 + layername + domouse2 + layername + domouse3_1 +
       domouse1_2 + layername + domouse2 + layername + domouse3_2 +
       iopen + iproduct7 + iclose + htagclose +
  layerclose )
}

 wrote in message
news:7ouj92$j7o$1...@news3.Belgium.EU.net...


OK I have redone my script in a more clear way and is clean now. But it
still won't work on Netscape.
I use arrays and I am making it more clear,
Thanks,
Sergio
-------------------------------------------------------
// This script creates a layer and its contents
// We set the variables in part 1 and in part 2 we produce the content
//1.1 Sets the array values for each layer
var thelayer = new Array ("products", "customer")
var itszindex = new Array ("2", "4")
var itsheight = new Array ("70", "89")
var itsleft = new Array ("239", "393")
var itswidth = new Array ("154", "160")
//1.2 Sets the content for each layer by using variables
var alayercontent = new Array ("image1a", "image1b", "image1c")
var blayercontent = new Array ("image2a", "image2b")
//1.3 Sets the variables for the
// 2.0 We create the layers
// 2.1 This creates each layer using the variables in part 1.1
layersloop:
for ( var i=0; i<thelayer.length; i++ ) {
 var px = "px;"
   document.write ("<div id='", thelayer[i], "'", "
style='position:absolute; width:", itswidth[i], px, "height:", itsheight[i],
px, "z-index:", itszindex[i], px, "left:", itsleft[i], px, "top:15px;
visibility: show\'>")
   document.close ()
// 2.2 This creates the content of each layer depending on which layer we
are on
    if (i==0) var layercontent = alayercontent;
    if (i==1) var layercontent = blayercontent;
    for (var ii=0; ii<layercontent.length; ii++) {
    document.write (layercontent[ii])
    if ( ii>layercontent.length ) break;
    }
// 2.3 We close the layer
    document.write ("</div>\n")
     document.close ()
     if ( i>thelayer.length ) break;
}