// イメージの読み込みとイベントをセット function onLoadPhoto() { if (!document.getElementsByTagName) return false; var imgObj = document.getElementsByTagName('img'); var set_html = ''; for (var i = 0; i < imgObj.length; i++) { if (imgObj[i].src.match(/p[0-9][0-9]s\./i)) { var photo_file = imgObj[i].src.replace(/(p[0-9][0-9])s\./i,'$1.'); var set_id = imgObj[i].src.replace(/.*\/p([0-9][0-9])s\..*/i,'photo$1'); var loadedImg = new Image(); loadedImg.src = photo_file; set_html += ''; imgObj[i].onmouseover = function() { this.style.cursor = 'pointer'; if (prev_id && document.getElementById(prev_id).style.display == 'inline') { document.getElementById(prev_id).style.display = 'none'; } this_id = this.src.replace(/.*\/p([0-9][0-9])s\..*/i,'photo$1'); document.getElementById(this_id).style.display = 'inline'; setOpacityZero(0, this_id); return false; } imgObj[i].onmouseout = function() { prev_id = this.src.replace(/.*\/p([0-9][0-9])s\..*/i,'photo$1'); setOpacityMax(10, prev_id); return false; } } } document.getElementById('photo').innerHTML = set_html; } var value_opacity; var this_id; var prev_id; // 透明度が10になるまで+1加算する(タイマー) function setOpacityZero(t, id) { var v = t; var e = document.getElementById(id); e.style.filter = 'alpha(opacity=' + (v * 10) + ')'; e.style.MozOpacity = v / 10; e.style.opacity = v / 10; if (v < 10) { v += 1; setTimeout('setOpacityZero('+v+',"'+id+'")', 15); } } // 透明度が0になるまで-1加算する(タイマー) function setOpacityMax(t, id) { var v = t; var e = document.getElementById(id); e.style.filter = 'alpha(opacity=' + (v * 10) + ')'; e.style.MozOpacity = v / 10; e.style.opacity = v / 10; if (v > 0) { v -= 1; setTimeout('setOpacityMax('+v+',"'+id+'")', 15); } else { document.getElementById(prev_id).style.display = 'none'; } } window.onload = onLoadPhoto;