Questo lo script :
<script type="text/javascript">
var t;
var p;
var tm;
function stSwa() {
sLft();
shSwa();
//var w = window.innerWidth != null? window.innerWidth: document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth:document.body != null? document.body.clientWidth: null;
var h = window.innerHeight != null? window.innerHeight: document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight:document.bod y != null? document.body.clientHeight: null;
if(h > 550) setInterval("keepUp()",1000);
}
function shSwa() {
t = 100;
mvUp(100000);
fd(0);
}
function hdSwa() {
t = 0;
fd(100);
}
function fd(amt) {
if((t == 100 && amt <= t) || (t == 0 && amt >= t)) sFd(amt);
else if(t == 0) mvUp(0);
amt += (t > 0)? 10:-10;
if(tm!=null) clearInterval(tm);
tm = setTimeout("fd("+amt+")", 20);
}
function sFd(amt) {
var obj;
if (document.layers) obj = document.layers.swa;
else if (document.all) obj = document.all.swa;
else if (document.getElementById) obj = document.getElementById("swa");
amt = (amt == 100)?99.999:amt;
// IE
obj.style.filter = "alpha(opacity:"+amt+")";
// Safari<1.2, Konqueror
obj.style.KHTMLOpacity = amt/100;
// Mozilla and Firefox
obj.style.MozOpacity = amt/100;
// Safari 1.2, newer Firefox and Mozilla, CSS3
obj.style.opacity = amt/100;
}
function sLft() {
var w = 550;
if (document.layers) document.layers.swa.left = ((window.innerWidth / 2) - (w / 2))+"px";
else if (document.all) document.all.swa.style.left = ((document.body.offsetWidth / 2) - (w / 2))+"px";
else if (document.getElementById) document.getElementById("swa").style.left = ((window.innerWidth / 2) - (w / 2))+"px";
}
function mvUp(amt) {
if (document.layers) document.layers.swa.zIndex = amt;
else if (document.all) document.all.swa.style.zIndex = amt;
else if (document.getElementById) document.getElementById("swa").style.zIndex = amt;
}
function keepUp() {
var obj = (document.all)? document.all.swa:document.getElementById("swa");
var iebody = (document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body;
var dsoctop = document.all? iebody.scrollTop : pageYOffset;
if (document.all || document.getElementById) {
obj.style.top = dsoctop+100+"px";
}
}
</script>
Mi apre un DIV centrato rispetto alla finestra del browser sia in WIDTH che HEIGHT.
Io vorrei invece che venga centrato solo lungo l'asse X e per ciò che riguarda l'asse Y possa dargli io un valore per esempio 10px.
Come posso fare ?