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
|
actionImporteTousParag = function(e)
{
e.target.style.backgroundColor = 'rgba(255, 255, 0, 0.9)';
console.log('Importer tous les paragraphes du modèle ');
/*xhrImporte.open('POST', 'ajax/ajaxModParagImporte.php');
xhrImporte.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhrImporte.send('prest=' + prestId + '&modele=' + modeleId);
e.target.style.visibility = 'hidden';*/
},
// *** Ajax event handlers ***
actionXhrModele = function(e)
{
if(e.target.readyState == 4)
{
if(e.target.status == 200)
{
divImport.innerHTML = e.target.responseText;
const leBoutonTousParag = divImport.querySelector('#tous');
leBoutonTousParag.addEventListener('click', actionImporteTousParag);
leBoutonTousParag.style.boxShadow = 'rgba(0, 0, 255, 0.9) 0.5vmin 0.5vmin 1vmin'; // OK, ombre bleue
console.log(leBoutonTousParag.value); // OK, il affiche "Tous"
console.log(leBoutonTousParag.onclick); // null
setTimeout
(
(ceci) =>
{
ceci.style.boxShadow = 'rgba(0, 255, 0, 0.9) 0.5vmin 0.5vmin 1vmin'; // Ne change pas le bouton, qui reste bleu. Aucune ombre verte
console.log(ceci.style.boxShadow); // Ici aussi, la console affiche bien rgba(0, 255, 0, 0.9) 0.5vmin 0.5vmin 1vmin
},
1000,
leBoutonTousParag
);
//leBoutonTousParag.addEventListener('click', function(e){console.log('Test fonction inline');});
}
else
{
divImport.innerHTML = '<P style="text-align:center;background-color:rgba(255, 0, 0, 0.6);">Echec requête ajax</P>';
}
divImport.innerHTML += '<P style="text-align:center;">' + (Date.now() - delai) + ' ms</P>';
}
}, |