Re: FURTHER ADDENDUM: javascript: DOM syntax for SPANS/DIVS ???

by "Phil Babcock" <pbabcock(at)bgsgroup.com>

 Date:  Wed, 24 Jan 2001 17:37:28 -0500
 To:  "Peter-Paul Koch" <gassinaumasis(at)hotmail.com>,
hwg-languages(at)hwg.org
 References:  hotmail
  todo: View Thread, Original
Perfect!

Here is the final function, based on your information.  As this is it will=
 only work with IE because of the style.visibility=3D'hidden/visible'=
 stuff, which is the only browser I really wanted it for anyway.  For NN I=
 will use another solution which will employ 'show/hide'.


<. script language=3D"JavaScript">
 function showSpan (SpanNumberToShow){ //var SpanNumberToShow starts at 0
 	var arrSpans; 
	var spanCount;

 	//arrSpans =3D document.getElementsByTagName ("span"); //less browser=
 compatible, in regards to IE version number?
 	arrSpans =3D document.body.all.tags("span") //more browser compatible?
	spanCount =3D arrSpans.length  // damned 0 based arrays argh!
	
	//debug stuff
	//alert("number of spans: " + spanCount + "");
	//alert ("span " + ( SpanNumberToShow + 1)  + " OLD visibility: " +=
 arrSpans[SpanNumberToShow].style.visibility + "");
	
	for (var i =3D 0; i < spanCount ; i++) { //loop through and set to=
 visible/hidden as required.
		if (i =3D=3D SpanNumberToShow) {
			arrSpans[i].style.visibility =3D 'visible';
		}
		else {
			arrSpans[i].style.visibility =3D 'hidden';
		}	
	 }
	
	//debug stuff	
	//alert ("span " + ( SpanNumberToShow + 1) + " NEW visibility: " +=
 arrSpans[SpanNumberToShow].style.visibility + "");
	
}

<. /script>

Now I can use this function to show one span at a time in a physical=
 location where there are a lot of spans. ie: I need to dynamically show=
 any given span and hide the rest, all in the same spot.

Make any sense at all?

thanks ppk!

phil.

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA

This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.