Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Jvascript & DHTML Layer Issues

Status
Not open for further replies.

newmediaguy

Programmer
Mar 26, 2004
176
GB
Hi Guys

Code:
var cur_lyr;	// holds id of currently visible layer
function swapLayers(id) {
 if (cur_lyr) hideLayer(cur_lyr);
  showLayer(id);
  cur_lyr = id;
}


function showLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "visible";
}

function hideLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "hidden";
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? getLyrRef(id,document): null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}
Level 1 Link
Code:
<a href="javascript://" onclick="swapLayers('S0'); return false; ">Statpack</a>
Level 2 link
Code:
<a href="javascript://" onclick="showLayers('Statpack'); return false">By Park/Group</a>

the menu works as follows:

Level1
Level2 ----> Shows Second Level
-----> Shows 3rd level but hides 2nd level

any thoughts?

Thanks

Glen

Glen
Conception | Execution
 
Fixed it.

Was bad code on my part..........doh!

Thanks

Glen

Glen
Conception | Execution
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top