1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
| function update_menu() {
// recup conteneur
var oParent = document.getElementById("menu");
// creation LI
var oLI = document.createElement('li');
// affectation de la classe
oLI.className = "write";
// creation de A
var oA_LI = document.createElement('a');
// affecte attribut
oA_LI.href = '#';
oA_LI.title = 'Write';
// creation text
var oTxt = document.createTextNode('Write');
// ajout text
oA_LI.appendChild( oTxt);
// ajout A
oLI.appendChild( oA_LI);
// creation UL
var oUL_LI = document.createElement('ul');
// creation LI
var oLI_UL = document.createElement('li');
// creation A
oA_LI = document.createElement('a');
// affecte attribut
oA_LI.setAttribute( 'href', '#');
oA_LI.setAttribute( 'title', 'Articles');
// la fonction sur le click
oA_LI.onclick = function(){
loadHTML("ajax-modal.html");
return( false);
}
// creation text
oTxt = document.createTextNode('Articles');
// ajout text -> A
oA_LI.appendChild( oTxt);
// ajout A -> LI
oLI_UL.appendChild( oA_LI);
// ajout LI -> UL
oUL_LI.appendChild( oLI_UL);
// creation LI
oLI_UL = document.createElement('li');
// creation A
oA_LI = document.createElement('a');
// affecte attribut
oA_LI.setAttribute( 'href', '#');
oA_LI.setAttribute( 'title', 'Add Article');
// la fonction sur le click
oA_LI.onclick = function(){
loadHTML("ajax-modal.html");
return( false);
}
// creation text
oTxt = document.createTextNode('Add article');
// ajout text -> A
oA_LI.appendChild( oTxt);
// ajout A -> LI
oLI_UL.appendChild( oA_LI);
// ajout LI -> UL
oUL_LI.appendChild( oLI_UL);
// ajout UL -> LI
oLI.appendChild( oUL_LI);
// ajout LI -> Parent
oParent.appendChild( oLI);
} |
Partager