画像の分割ランダム表示

 

|戻る|

このページのソース
<HTML><HEAD><TITLE>random</TITLE> <SCRIPT LANGUAGE="JavaScript"> <!-- Images=new Array(6); Images[1]=new Image();Images[1].src="k1.jpg"; Images[2]=new Image();Images[2].src="k2.jpg"; Images[3]=new Image();Images[3].src="k3.jpg"; Images[4]=new Image();Images[4].src="k4.jpg"; Images[5]=new Image();Images[5].src="k5.jpg"; Images[6]=new Image();Images[6].src="k6.jpg"; function change_image(){ var n=Math.random(); if(n<=0.2) document.image1.src=Images[1].src; else{if(n<=0.4) document.image1.src=Images[2].src; else{if(n<=0.6) document.image1.src=Images[3].src; else{if(n<=0.8) document.image1.src=Images[4].src; else{if(n<=1) document.image1.src=Images[5].src; }}}}; var m=Math.random(); if(m<=0.2) document.image2.src=Images[2].src; else{if(m<=0.4) document.image2.src=Images[3].src; else{if(m<=0.6) document.image2.src=Images[4].src; else{if(m<=0.8) document.image2.src=Images[5].src; else{if(m<=1) document.image2.src=Images[6].src; }}}}; var l=Math.random(); if(l<=0.2) document.image3.src=Images[3].src; else{if(l<=0.4) document.image3.src=Images[4].src; else{if(l<=0.6) document.image3.src=Images[5].src; else{if(l<=0.8) document.image3.src=Images[6].src; else{if(l<=1) document.image3.src=Images[1].src; }}}}; var k=Math.random(); if(k<=0.2) document.image4.src=Images[4].src; else{if(k<=0.4) document.image4.src=Images[5].src; else{if(k<=0.6) document.image4.src=Images[6].src; else{if(k<=0.8) document.image4.src=Images[1].src; else{if(k<=1) document.image4.src=Images[2].src; }}}}; var p=Math.random(); if(p<=0.2) document.image5.src=Images[5].src; else{if(p<=0.4) document.image5.src=Images[6].src; else{if(p<=0.6) document.image5.src=Images[1].src; else{if(p<=0.8) document.image5.src=Images[2].src; else{if(p<=1) document.image5.src=Images[3].src; }}}}; var q=Math.random(); if(p<=0.2) document.image6.src=Images[6].src; else{if(p<=0.4) document.image6.src=Images[1].src; else{if(p<=0.6) document.image6.src=Images[2].src; else{if(p<=0.8) document.image6.src=Images[3].src; else{if(p<=1) document.image6.src=Images[4].src; }}}}; setTimeout('change_image()',1000); } //ランダムに画像を表示--> </SCRIPT> </HEAD> <BODY BGCOLOR="#FFFFFF" onLoad="change_image()"> <CENTER> 画像の分割ランダム表示<BR> <TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0> <TR> <TD> <IMG SRC="k1.jpg" NAME="image1"></TD> <TD> <IMG SRC="k2.jpg" NAME="image2"></TD> </TR> <TR> <TD> <IMG SRC="k3.jpg" NAME="image3"></TD> <TD> <IMG SRC="k4.jpg" NAME="image4"></TD> </TR> <TR> <TD> <IMG SRC="k5.jpg" NAME="image5"></TD> <TD> <IMG SRC="k6.jpg" NAME="image6"></TD> </TR> </TABLE> </CENTER> </BODY> </HTML>

|戻る|