重なった画像を選択クリックで表示を入れ替え
1 2 3 |
<!-- html表記 --> <img src="画像のurl" id="img1" style="border:2px solid #ffd700; z-index:1;position:absolute;top:10;left:20" onClick="order(1)" width="75%" height="auto"> <img src="画像のurl" id="img2" style="border:2px solid #ffd700; z-index:2;position:absolute;top:40;left:50" onClick="order(2)" width="75%" height="auto"> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
// JavaScript表記 <script type="text/javascript"> <!-- function order(n){ if(n==1){ document.getElementById("img1").style.zIndex=2; document.getElementById("img2").style.zIndex=1; } if(n==2){ document.getElementById("img1").style.zIndex=1; document.getElementById("img2").style.zIndex=2; } } //--> </SCRIPT> |