IE11 javascriptについて
すみません、IE11なってから、以下のjavascriptが動かなくなりました。
画像は、フェードイン、フェードアウトを繰り返し、画像はランダムに移動します。
全部のロジックを書いてしまいましたが、
何処がIE11から変更されたかが解らなくて、困っている所です。
何処を直すのか、全部聞くのもあつかましいと思いました、
どのあたりを見直しすれば宜しいですか。
教えて頂ければ幸いです。
<SCRIPT language="JavaScript">
<!--
var img = new Array();
img[0] = new Image(); img[0].src = "img/4031.jpg";
img[1] = new Image(); img[1].src = "img/4032.jpg";
img[2] = new Image(); img[2].src = "img/4031.jpg";
img[3] = new Image(); img[3].src = "img/4032.jpg";
img[4] = new Image(); img[4].src = "img/4031.jpg";
imgMaxSizeW = 171;
imgMaxSizeH = 141;
alphaTimer = 10;
stopTimer = 2000;
nextImgTimer = 1000;
_dom=(document.all?3:(document.getElementById?1:(document.layers?2:0)));
function getWindowSize() {
if(_dom == 1 || _dom == 2) {
win_width = self.innerWidth;
win_height = self.innerHeight;
}
if (_dom == 3) {
win_width = document.body.clientWidth;
win_height = document.body.clientHeight;
}
}
function showLayer(layerName){
if (_dom == 1) document.getElementById(layerName).style.visibility = "visible";
if (_dom == 2) document.layers[layerName].visibility = "show";
if (_dom == 3) document.all(layerName).style.visibility = "visible";
}
function hideLayer(layerName){
if (_dom == 1) document.getElementById(layerName).style.visibility = "hidden";
if (_dom == 2) document.layers[layerName].visibility = "hide";
if (_dom == 3) document.all(layerName).style.visibility = "hidden";
}
function writeHTML(layerName,html) {
if (_dom == 1) {
var div = document.getElementById(layerName);
while(div.hasChildNodes()) div.removeChild(div.lastChild);
var range=document.createRange();
range.selectNodeContents(div);
range.collapse(true);
var cf=range.createContextualFragment(html);
div.appendChild(cf);
}
if (_dom == 2) {
var div = document.layers[layerName];
div.document.open();
div.document.write(html);
div.document.close();
}
if (_dom == 3) document.all(layerName).innerHTML = html;
}
function moveLayerTo(layerName, x, y){
if (_dom == 1) {
document.getElementById(layerName).style.left = x + scrollX;
document.getElementById(layerName).style.top = y + scrollY;
}
if (_dom == 2) {
document.layers[layerName].left = x + pageXOffset;
document.layers[layerName].top = y + pageYOffset;
}
if (_dom == 3) {
document.all(layerName).style.pixelLeft = x + document.body.scrollLeft
document.all(layerName).style.pixelTop = y + document.body.scrollTop;
}
}
function changeAlpha(layerName) {
if (_dom == 3) {
if (alphaCount < 200) {
alphaCount += 2; op = alphaCount > 100 ? 100 - (alphaCount-100) : alphaCount;
document.all(layerName).filters["alpha"].opacity = op;
if (op == 100) {
tim = setTimeout("changeAlpha('"+layerName+"')", stopTimer);
} else {
tim = setTimeout("changeAlpha('"+layerName+"')", alphaTimer);
}
} else {
hideLayer(layerName);
clearTimeout(tim);
tim = setTimeout("setAlphaImgPos()",nextImgTimer);
}
} else {
setTimeout("setAlphaImgPos()",nextImgTimer*2);
}
}
var imgCount = 0;
function setAlphaImgPos() {
writeHTML("imgLay",'<IMG src="' + img[imgCount].src + '" border="0">');
imgCount++; if (imgCount >= img.length) imgCount = 0;
getWindowSize();
sX = Math.floor(Math.random()*(win_width-imgMaxSizeW-10));
sY = Math.floor(Math.random()*(win_height-imgMaxSizeH-10));
moveLayerTo("imgLay",sX,sY);
showLayer("imgLay");
alphaCount = 0;
changeAlpha("imgLay");
}
window.onload = setAlphaImgPos;
// -->
</SCRIPT>