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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How refer to UL tags in my Javascript function?

Status
Not open for further replies.
Oct 11, 2006
300
US
I have this HTML code which is built dynamically:

Code:
<[b]ul id="UI2271284"[/b] style="display: none">
							
<li>
	<input type="radio" name="empid" id="empid40962" value="40962">Julie Breslow&nbsp;<font size=1>(40962)</font>
</li>

<li>
	<input type="radio" name="empid" id="empid41382" value="41382">Frank Duplak&nbsp;<font size=1>(41382)</font>			
</li>

</ul>

My javascript function refers to this UL tag. But how I refer to the 'UI' before the number?

Javascript function is:

Code:
function s_Hide(el){
[b]	obj = document.getElementById(el).style;[/b]
	(obj.display == 'none')? obj.display = 'block' : obj.display = 'none';
	//Need to store the current state on a cookie
	var uniqueStr = '&' + el + '&'
	if (obj.display == 'block')
	{
	  // add it to the string openedItems
	  //alert("Add '" + uniqueStr + "'");
	  openedItems = openedItems.concat(uniqueStr);
	}
	else
	{
	  // remove it from the string openedItems
	  //alert("Remove '" + uniqueStr + "'");
	  openedItems = openedItems.replace(uniqueStr, '');
	}
	//alert(openedItems);
}
 
I added this line to the Javascript function to refer to the UL tag id:

Code:
elID = 'UI_'+ el;
obj = document.getElementById(elID).style;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top