私がOperaブラウザで抱えているこの奇妙な問題を誰かが助けてくれることを願っています。バージョン11ベータ版をインストールしていますが、Operaの一般的な問題だと思います。
問題のウェブサイトとページはhttp://www.amigaos.net/index.htmlです。
HTMLの本文の下部に、ページの読み込み時にビューポートの幅に応じて、このWebページに表示される3つの画像のサイズを変更する次のコードがあります。SafariとFireFoxではコードは正常に機能しますが、Operaでは画像の幅と高さのサイズ変更を伴う次の行は機能しません。
document.getElementById('img1').width = '475';
document.getElementById('img1').height = '375';
これが完全なコードです(レイアウトについては、stackoverflowがキャリッジリターンを正しくフォーマットしていません)
<script type="text/javascript">
function GetWidth()
{
var x = 0;
if (typeof window.innerWidth != 'undefined')
{
x = window.innerWidth;
}
else if (document.documentElement && document.documentElement.clientHeight)
{
x = document.documentElement.clientWidth;
}
else if (document.body)
{
x = document.getElementsByTagName('body')[0].clientWidth;
}
return x;
}
width = GetWidth();
if (width>=1680)
{
document.getElementById('img1').width = '475';
document.getElementById('img1').height = '375';
document.getElementById('img2').width = '475';
document.getElementById('img2').height = '375';
document.getElementById('img3').width = '475';
document.getElementById('img3').height = '375';
}
else if ((width>800) && (width<=1280))
{
document.getElementById('img1').width = '300';
document.getElementById('img1').height = '235';
document.getElementById('img2').width = '300';
document.getElementById('img2').height = '235';
document.getElementById('img3').width = '300';
document.getElementById('img3').height = '235';
}
else if (width<=800)
{
document.getElementById('img1').width = '225';
document.getElementById('img1').height = '195';
document.getElementById('img2').width = '225';
document.getElementById('img2').height = '195';
document.getElementById('img3').width = '225';
document.getElementById('img3').height = '195';
}
</script>