Netscape 4.x has a very poor implementation of JavaScript, which is what I assume is not working properlly looking at your code snippet.
I wouldn't worry about it myself. When I do client-side JavaScript, I don't even bother catering to Netscape 4.x anymore. It's not worth the effort as very few people use that browser.
If Netscape 7 works ok, then that's prolly good enough.
If you must get Netscape 4.x compatibility going, then I'd have a look at how you're referencing the textarea element 'currentSelections'.
First you start of by calling the updateTextBox function, and passing a reference to the current element (this) and one to currentSelections.
updateTextBox(this, currentSelections);
Then in the updateTextBox function you have this line of code:
textBoxObj.value += selection + "\n";
My guess is that the JavaScript implementation in Netscape 4.x is too primative to make a reference to an object the way you passed it there.
Maybe trying this instead:
Pass a string 'currentSelections' to the funtion
updateTextBox(this, 'currentSelections');
then in the function reference the object like so:
function updateTextBox(selectObj, textBoxName) {
textBoxObj = getObj(textBoxName);
}
function getObj(name)
{
if (document.getElementById)
{
return document.getElementById(name);
}
else if (document.all)
{
return document.all[name];
}
else if (document.layers)
{
return getObjNN4(document,name);
}
}
function getObjNN4(obj,name)
{
var x = obj.layers;
var foundLayer;
for (var i=0;i<x.length;i++)
{
if (x.id == name)
foundLayer = x;
else if (x.layers.length)
var tmp = getObjNN4(x,name);
if (tmp) foundLayer = tmp;
}
return foundLayer;
}
If you reference objects with a function like that, it should work across most browsers. The getObjNN4() function will recursivly search through layers in Netscape 4 which can be a pain when finding elements.
Also you should give elements an ID not a name. Names should only be used on form elements for submitting data.
Eg.
<textarea name = 'currentSelections' id = 'currentSelections' readonly="readonly" rows = "20" cols = "45"></textarea>
hope that helps. I didn't test any of the code, so just play around if it doesn't work straight away.
-Adam 🙂