<script type='text/javascript'>
<!--
function resizeToLAYER(layName,width,height){ if(window.opera){ //opera document.getElementById(layName).style.pixelWidth = width document.getElementById(layName).style.pixelHeight = height } else if(document.getElementById){ //e5,e6,n6,n7,m1用 document.getElementById(layName).style.width = width+'px' document.getElementById(layName).style.height = height+'px' } else if(document.all){ //e4用 document.all(layName).style.pixelWidth = width document.all(layName).style.pixelHeight = height } else if(document.layers) //n4用 document.layers[layName].resizeTo(width,height) }
function setBGCOLOR(layName,color){
//opera は透明が効かないのでページ背景色と同色へ便宜修正
if(color=='')(!!window.opera)?color='white':color='transparent';
if(document.getElementById) //e5,e6,n6,n7,m1,o6用
document.getElementById(layName).style.backgroundColor =color
else if(document.all) //e4用
document.all(layName).style.backgroundColor=color
else if(document.layers){ //n4用
if(color=='transparent')color=null
document.layers[layName].bgColor=color
}
}
function setBGIMG(layName,image){
if(document.getElementById) //e5,e6,n6,n7,m1,o6用
document.getElementById(layName).style.backgroundImage
= (image=='')?'':'url('+image+')'
else if(document.all) //e4用
document.all(layName).style.backgroundImage='url('+image+')'
else if(document.layers) //n4用
document.layers[layName].background.src=(image=='')?null:image
}
//-->
</script>
<body onload="resizeToLAYER('lay0',100,50) ; resizeToLAYER('lay1',100,50) ; setBGCOLOR('lay0','cyan') ; setBGIMG('lay1','./300300.gif');">
<div id="lay0"
style="position : absolute ;
left : 200px ;
top : 200px ;
width : 100px ;
height : 50px ;">
T E S T 0
</div>
<div id="lay1"
style="position : absolute ;
left : 400px ;
top : 200px ;
width : 100px ;
height : 50px ;">
T E S T 1
</div>
<form>
<input type="button"
value="TEST0 を 100×100にリサイズ"
onclick="resizeToLAYER('lay0',100,100)"><br>
<input type="button"
value="TEST0 を 100×300にリサイズ"
onclick="resizeToLAYER('lay0',100,300)"><br>
<input type="button"
value="TEST0 を 300×100にリサイズ"
onclick="resizeToLAYER('lay0',300,100)"><br><br>
<input type="button"
value="TEST1 を 100×100にリサイズ"
onclick="resizeToLAYER('lay1',100,100)"><br>
<input type="button"
value="TEST1 を 100×300にリサイズ"
onclick="resizeToLAYER('lay1',100,300)"><br>
<input type="button"
value="TEST1 を 300×100にリサイズ"
onclick="resizeToLAYER('lay1',300,100)"><br>
</form>
* 緑文字が今回の関数
* 赤文字がこのスクリプトで最初に動作する部分
|