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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
| <?php
header("Content-Type: text/javascript");
?>
if (window.innerHeight) {
//Navigateurs sauf Explorer
var fenHeight = window.innerHeight;
var fenWidth = window.innerWidth;
}
else if (document.documentElement && document.documentElement.clientHeight) {
//Internet Explorer mode Strict
var fenHeight = document.documentElement.clientHeight;
var fenWidth = document.documentElement.clientWidth;
}
else if (document.body && document.body.clientHeight) {
//Autres Internet Explorer
var fenHeight = document.body.clientHeight;
var fenWidth = document.body.clientWidth;
}
function scroll_fenetre()
{
if (window.innerHeight) {
//Navigateurs sauf Explorer
var scroll = 0;
}
else if (document.documentElement && document.documentElement.scrollTop) {
//Internet Explorer mode Strict
var scroll = document.documentElement.scrollTop;
}
else if (document.body && document.body.scrollTop) {
//Autres Internet Explorer
var scroll = document.body.scrollTop;
}
if (window.ActiveXObject && window.XMLHttpRequest && window.external && document.compatMode=="CSS1Compat") {
var scroll=0;
}
return scroll;
}
function IEFixedElementPos()
{
// IE 7 en mode standard
if (window.ActiveXObject && window.XMLHttpRequest && window.external && document.compatMode=="CSS1Compat")
{
return ("fixed");
}
return ("absolute");
}
document.write('<style type="text/css">\n'+
'#leader_box \n'+
' {\n'+
' position:fixed;\n'+
' width:\n'+fenWidth+'px;\n'+
' height:20px;\n'+
' top:0px;\n'+
' left:0px;\n'+
' position: expression(IEFixedElementPos());;\n'+
' top: expression(scroll_fenetre());\n'+
' }\n'+
'</style>');
var code="<table id='leader_box'><tr><td bgcolor=#FFFFFF>test</td></tr></table>";
var b = document.getElementsByTagName("body")[0];
b.insertbefore(code,b); |
Partager