Fejl i JavaScript
Er der nogen der kan finde fejlen(e) i dette JacaScript:<script language="JavaScript">
<!--
function namosw_list(parlayer, visible, width, height, font, size, fgColor, bgColor, indent, hbgColor) {
this.additem = namosw_l_additem;
this.addlist = namosw_l_addlist;
this.build = namosw_l_build;
this.rebuild = namosw_l_rebuild;
this._writeList = namosw_l_writelist;
this._showList = namosw_l_showlist;
this._updateList = namosw_l_updatelist;
this._updateParent = namosw_l_updateparent;
this.lists = new Array(); // sublists
this.items = new Array(); // layers
this.types = new Array(); // type
this.strs = new Array(); // content
this.x = 0;
this.y = 0;
this.visible = visible;
this.id = document.namosw_lists.length;
this.i = indent;
this.space = true;
this.pid = 0;
this.fontIntro = '<font color=' + fgColor;
if (font != '') this.fontIntro += ' face=\"' + font + '\"';
if (size != '') this.fontIntro += ' size=' + size;
this.fontIntro += '>';
this.fontOutro = '</font>';
this.width = width || 350;
this.height = height || 22;
this.parLayer = parlayer;
this.built = false;
this.shown = false;
this.needsUpdate = false;
this.needsRewrite = false;
this.parent = null;
this.l = 0;
if (bgColor) this.bgColor = bgColor;
else this.bgColor = null;
if (hbgColor) this.hbgColor = hbgColor;
else this.hbgColor = null;
document.namosw_lists[document.namosw_lists.length] = this;
}
function namosw_l_setclip(layer, l, r, t, b) {
if(navigator.appName == "Netscape") {
layer.clip.left = l; layer.clip.right = r;
layer.clip.top = t; layer.clip.bottom = b;
} else {
layer.style.pixelWidth = r-l;
layer.style.pixelHeight = b-t;
layer.style.clip = "rect("+t+","+r+","+b+","+l+")";
}
}
function namosw_l_updateparent(pid, l) {
var layer;
if(!l) l = 0;
this.pid = pid;
this.l = l;
for(var i = 0; i < this.types.length; i++)
if(this.types[i] == "list")
this.lists[i]._updateParent(pid, l+1);
}
function namosw_l_expand(i) {
document.namosw_lists[i].visible = !document.namosw_lists[i].visible;
document.namosw_lists[document.namosw_lists[i].pid].rebuild();
}
function namosw_l_additem(str, url, frame) {
var testLayer = false;
if (navigator.appName.indexOf("Microsoft") != -1 || !this.parLayer) {
testLayer = eval('document.all.namoswlistitem'+document.namosw_lists.lid);
} else {
testLayer = eval('this.parLayer.document.layers.namoswlistitem'+document.namosw_lists.lid);
}
if (testLayer) {
layer = testLayer;
} else {
if(navigator.appName == "Netscape") {
layer = this.parLayer ? new Layer(this.width, this.parLayer) :
new Layer(this.width);
} else {
return;
}
}
if (url) layer.url = url;
if (frame) layer.frame = frame;
this.items[this.items.length] = layer;
this.types[this.types.length] = "item";
this.strs[this.strs.length] = str;
if (this.hbgColor) layer.hbgColor = this.hbgColor;
if (this.bgColor) layer.oBgColor = this.bgColor;
namosw_l_set_layer_action(layer);
document.namosw_lists.lid++;
}
function namosw_l_addlist(list, str, url, frame) {
var testLayer = false;
if (navigator.appName.indexOf("Microsoft") != -1 || !this.parLayer) {
testLayer = eval('document.all.namoswlistitem'+document.namosw_lists.lid);
} else {
testLayer = eval('this.parLayer.document.layers.namoswlistitem'+document.namosw_lists.lid);
}
if (testLayer) {
layer = testLayer;
} else {
if(navigator.appName == "Netscape") {
layer = this.parLayer ? new Layer(this.width, this.parLayer) :
new Layer(this.width);
} else {
return;
}
}
if (url) layer.url = url;
if (frame) layer.frame = frame;
this.lists[this.items.length] = list;
this.items[this.items.length] = layer;
this.types[this.types.length] = "list";
this.strs[this.strs.length] = str;
list.parent = this;
if (this.hbgColor) layer.hbgColor = this.hbgColor;
if (this.bgColor) layer.oBgColor = this.bgColor;
namosw_l_set_layer_action(layer);
document.namosw_lists.lid++;
}
function namosw_init_list(top_layer)
{
if(parseInt(navigator.appVersion) < 4) {
alert("Sorry, a 4.0+ browser is required to view this demo.");
return;
}
document.namosw_lists = new Array();
document.namosw_lists.lid = 0;
var layer;
if (navigator.appName == 'Netscape')
layer = document.layers[top_layer];
else
layer = document.all[top_layer];
l1 = new namosw_list(layer, true, 200, 22, 'Arial', '1', 'black', 'gray', 0, '#C2C2C2');
l2 = new namosw_list(layer, false, 200, 17, 'Arial', '1', 'black', 'silver', 0, 'white');
l2.additem('Udstyr 1', '', 'self');
l2.additem('udstyr 2', '', 'self');
l1.addlist(l2, 'udstyr', 'udstyr.html', 'self');
l1.additem('Om Carso', 'om.html', 'self');
l1.make(0, 14);
}
//-->
</script>
</head>
<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red" onload="namosw_init_list('layer1');">
<p><div id="layer1" style="position:absolute; left:19px; top:14px; width:200px; height:200px; z-index:1; border-width:1px; border-style:none;">
<div id="namoswlistitem0" style="position: absolute;"></div>
<div id="namoswlistitem1" style="position: absolute;"></div>
<div id="namoswlistitem2" style="position: absolute;"></div>
<div id="namoswlistitem3" style="position: absolute;"></div>
<div id="namoswlistitem4" style="position: absolute;"></div>
<p> </p>
</div></p>
</body>
</html>
