// (gH) -_- tp4ex1.js ; TimeStamp (unix) : 28 Mars 2010 vers 14:50
// ######################################################################
function creation() {
// ######################################################################
// partie du haut
eltpa = window.document.createElement("p") ;
eltpa.setAttribute("id","p1") ;
text0 = window.document.createTextNode("Bonjour") ;
text1 = window.document.createTextNode(" les ") ;
text2 = window.document.createTextNode("petits") ;
text3 = window.document.createTextNode(" enfants !") ;
eltsp = window.document.createElement("span") ;
eltgr = window.document.createElement("b") ;
eltsp.appendChild(eltgr) ;
eltsp.setAttribute("class","gbleu") ;
eltsp.setAttribute("className","gbleu") ;
eltgr.appendChild(text2) ;
eltpa.appendChild(text0) ;
eltpa.appendChild(text1) ;
eltpa.appendChild(eltsp) ;
eltpa.appendChild(text3) ;
window.document.body.appendChild(eltpa) ;
// partie du bas
eltp2 = window.document.createElement("p") ;
eltah = window.document.createElement("a") ;
texte = window.document.createTextNode(" cliquez moi ") ;
eltah.setAttribute("href","non.php") ;
eltah.setAttribute("onclick","changement() ; return false ") ;
eltah.setAttribute("class","bouton_rectangulaire vert_pastel") ;
eltah.setAttribute("className","bouton_rectangulaire vert_pastel nou") ;
eltah.appendChild(texte) ;
eltp2.appendChild(eltah) ;
window.document.body.appendChild(eltp2) ;
} ; // fin de fonction creation
// ######################################################################
function changement() {
// ######################################################################
while (window.document.body.firstChild) {
window.document.body.removeChild(window.document.body.firstChild )
} ; // fin de tant que
nouvh1 = window.document.createElement("h1") ;
nouvtx = window.document.createTextNode("Bonsoir") ;
nouvh1.appendChild(nouvtx) ;
window.document.body.appendChild(nouvh1) ;
} ; // fin de fonction changement
// ######################################################################
|