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
| (function() {
//alert('This page is : ' + document.title);
var mesimages = document.getElementsByTagName("img");
for(var i = 0; i < mesimages.length; i++){
console.log(mesimages[i].src);
}
var xhr = new XMLHttpRequest();
xhr.open('POST', 'http://localhost:8080/wishlist/private/popup2.jsp',true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send('param1=' + mesimages[1].src + '¶m2=' + mesimages[2].src);
xhr.addEventListener('readystatechange', function() {
if (xhr.readyState === xhr.DONE) { // La constante DONE appartient à l'objet XMLHttpRequest, elle n'est pas globale
width = 300;
height = 200;
if(window.innerWidth)
{
var left = (window.innerWidth-width)/2;
var top = (window.innerHeight-height)/2;
}
else
{
var left = (document.body.clientWidth-width)/2;
var top = (document.body.clientHeight-height)/2;
}
window.open('http://localhost:8080/wishlist/private/popup2.jsp','nom_de_ma_popup','menubar=no, scrollbars=no,directories=no,status=no,location=no, top='+top+', left='+left+', width='+width+', height='+height+'');
//il existe un attribut pour empêcher de resizer aussi !
}
}, false);
})(); |
Partager