[thelist] simple Javascript help

Chris Marsh chris at webbtech.co.uk
Fri Nov 1 12:46:01 CST 2002


>    Hi Chris;
>    Feeling remarkably dumb right now, but what function

Not at all. I didn't really explain myself very well ;)

> should I call on the OnChange for all this to take effect?

I was actually just illustrating some x-browser code I have written
recently that seems to work okay. However, for your application,
something along the following lines would be much better:

function StyleObject(id) {
  if(document.getElementById) {
    var s = document.getElementById(id).style;
  else if(document.all) {
    var s = document.all[id].style;
  else if(document.layers) {
    var s = document.layers[id];
  return s;

function fnShowHide(param) {
  StyleObject("Banner").visibility = "hidden";
  StyleObject("n").visibility = "hidden";
  StyleObject("All").visibility = "hidden";
  StyleObject("TextLink").visibility = "hidden";
  StyleObject("WebServices").visibility = "hidden";
  StyleObject("Content").visibility = "hidden";
  StyleObject(param).visibility = "visible";

Then call fnShowHide() as you did before. This code is TOTALLY untested,
btw, so I'm sorry if there are errors--I'm ni a bit of a hurry at the


Chris Marsh

More information about the thelist mailing list