Et bien comme vous êtes bien parti, je lache le code complet.
JS :
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
| function popwin(html){
var popdiv = document.getElementById("popwin");
var popdiv2 = document.getElementById("popwin2");
var popdivh = 250;
var popdivw = 350;
popdiv.style.width = popdivw + "px";
popdiv.style.height = popdivh + "px";
popdiv.innerHTML = '<div style=\'text-align:right;border-bottom:1px solid #999999;margin-bottom:3px\'><span class=\'text\' style=\'cursor:pointer\'onclick="close_popwin()">Fermer [X]</span></div><div><span class=\'text\'>' + html + '<span></div>';
if (window.innerWidth)
var popdiv2w = window.innerWidth;
else
var popdiv2w = document.body.clientWidth;
if (window.innerHeight)
var popdiv2h = window.innerHeight;
else
var popdiv2h = screen.height;
popdiv.style.top = "150px";
popdiv.style.left = (popdiv2w - popdivw)/2 + "px";
popdiv2.style.height = popdiv2h + "px";
popdiv2.style.width = popdiv2w + "px";
popdiv.style.visibility = 'visible';
popdiv2.style.visibility = 'visible';
}
function close_popwin(){
popdiv.style.visibility = 'hidden';
popdiv2.style.visibility = 'hidden';
} |
CSS :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| #popwin {
position : absolute;
visibility : hidden;
padding:3px;
background-color : #FFFFFF;
border : 1px solid #000000;
color : #000000;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight:300;
font-size:11px;
}
#popwin2 {
position : absolute;
visibility : hidden;
top:0;
left:0;
background-color : #000000;
filter : Alpha(opacity=60);
opacity : 0.60;
} |
HTML :
<div id='popwin2'></div><div id='popwin'></div>
PHP :
1 2 3 4 5 6 7 8
| function popwin($html)
{
$traduction = array( "'" => "\\'", "\"" => "\\"", "<" => "<", ">" => ">" );
$html = strtr($html , $traduction);
$popwin = "onclick=\"popwin('" . $html . "')\"";
return $popwin;
} |
PS : je suis preuneur en matière de critiques.
Partager