Jump to content

User:DannyS712 test/menu.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/***
function addCSS(filename){
	var head = document.getElementsByTagName('head')[0];
	var style = document.createElement('link');
	style.href = 'User:DannyS712 test/menu.css';
	style.type = 'text/css';
	style.rel = 'stylesheet';
	head.append(style);
}***/
function addlimenu(tabs, name, id, href, position) {
    var na, mn;
    var li;

    if (!id)  id = name;
    if (!href) href = '#';

    na = document.createElement("a");
    na.appendChild(document.createTextNode(name));
    na.href = href;
    mn = document.createElement("ul");
    li = document.createElement("li");
    li.appendChild(na);
    li.appendChild(mn);
    if (id) li.id = id;
    li.className = 'tabmenu';

    if (position) {
        tabs.insertBefore(li, position);
    } else {
        tabs.appendChild(li);
    }

    //return mn;  // useful because it gives us the <ul> to add <li>s to
}