All pastes #478479 Raw Edit

Something

public text v1 · immutable
·published 2007-05-09 05:44 UTC
rendered paste body
/* HTML



         <tr>
            <td class='softrow5'>
               <div class='fname'>{$f['name']}</div>
               <div class='fdesc'>{$f['description']}</div>
            </td>
            <td class='softrow6'>
               <a href="#" id="linkSkin{$f['id']}">Menu</a>
<script type='text/javascript'>
build_menu("linkSkin{$f['id']}",
	Array(
		"test",
		"--SKIP--",
		"rawr"
	)
);
</script>
            </td>
         </tr>



*/


var menu_registry = Array();
function build_menu(name, menu)
{
	var menuClass = "dropmenu";
	var rowClass = "dropmenurow";
	html = "\n<div class='"+menuClass+"' id='"+name+"_menu' style='display:none;z-index:100;'>\n";

	if(parseInt(menu.length) > 0)
	{
		for(var i=0;(i<menu.length);i++)
		{
			if(menu[i].match(/^--SKIP--/))
			{
				html += '';
			}
			else
			{
				html += "<div class='"+rowClass+"'>\n"+menu[i]+"\n</div>\n";
			}
		}
	}
	
	html += "\n</div>\n";
	
	obj = get_byid(name);
	
	obj.onclick = function()
	{
		toggle_obj(menu_registryp[i]+"_menu");
	}
	
	if(html != '')
	{
		obj.parentNode.innerHTML += html;		
	}
	
	return;
}


function toggle_obj(n)
{
	alert('test');
	obj = get_byid(n);
	
	if(obj.style.display == '')
	{
		obj.style.display = 'none';
	}
	else
	{
		obj.style.display = '';
	}
}

function get_byid(name)
{
	return document.getElementById(name);
}