この辺が怪しいですよ。
<script language="JavaScript">
<!--
function getTopOffset() {
if(document.all) {
if(document.compatMode == "CSS1Compat")
return document.body.parentNode.scrollTop;
else if(document.body.scrollTop)
return document.body.scrollTop;
else
return 0;
}
else {
return window.pageYOffset;
}
}
function getWindowWidth() {
if(window.innerWidth)
return window.innerWidth;
if(document.compatMode == "CSS1Compat")
return document.body.parentNode.clientWidth;
if(document.body.clientWidth)
return document.body.clientWidth;
}
function getWindowHeight() {
if(window.innerHeight)
return window.innerHeight;
if(document.compatMode == "CSS1Compat")
return document.body.parentNode.clientHeight;
if(document.body.clientHeight)
return document.body.clientHeight;
}
var ad = document.getElementById("adRight");
var timer;
function stickyAd() {
var left = parseInt(getWindowWidth()/2 + 775/2) + 5;
var top = parseInt((getWindowHeight()/2 - 40) + getTopOffset());
if(document.all) {
ad.style.pixelLeft = left;
ad.style.pixelTop = top;
}
else {
ad.style.left = left + "px";
ad.style.top = top + "px";
}
if(ad.style.display == "none")
ad.style.display = "";
if(!document.all) {
clearTimeout(timer);
timer = setTimeout("stickyAd()", 40);
}
}
if(document.all) {
stickyAd();
window.onscroll = stickyAd;
}
else {
setInterval("stickyAd()", 40);
}
window.onresize = stickyAd;
//-->
</script>
お礼
有難うございました。ばっちり出来ました。