[thelist] More Javascript Urg

Martyn Haigh martyn.haigh at virgincosmetics.com
Thu Jan 9 05:21:01 CST 2003


Hi,

I'm having some problems with javascript and opera - this works in IE6 &
Mozilla PC(not tested on Mac).

I have a simple API :

function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}

Some JS :

	x = new getObj('ClassText');
	x.style.display = 'none';
	x = new getObj('ClassInp');
	x.style.display = 'none';

Some HTML (cut down version):

<input id="ConsInp" type="text" />
<span id="ConsText">Please state name:&nbsp;</span>

But it doesn't work in Opera - does anyone know why?

Thank you!!

M


DISCLAIMER: The information in this email is confidential and may be legally
privileged. It is intended solely for the addressee. Access to this email by
anyone else is unauthorised. If you are not the intended recipient, any
disclosure, copying, distribution or any action taken or omitted to be taken
in reliance on it, is prohibited and may be unlawful.





More information about the thelist mailing list