1、おみくじ用の画像を作成する
2、ランダムに画像を表示するスクリプトが入ったページを作成する
3、上の1のページを呼び出すスクリプトが入ったページを作成する
<SCRIPT language="JAVASCRIPT">
<!--
//ケイエックスパソコン教室 おみくじ見本
RAND=Math.floor(Math.random()*6); //ランダムな数を発生させる
IMGNAME=new Array(5); //5つ配列を作る
IMGNAME[0]="daikyo.gif"; // 大凶の画像の名前を配列に入れる
IMGNAME[1]="kyo.gif"; // 凶の画像の名前を配列に入れる
IMGNAME[2]="shokichi.gif"; // 小吉
IMGNAME[3]="chukichi.gif"; // 中吉
IMGNAME[4]="daikichi.gif"; // 大吉
IMGNAME[5]="kichi.gif"; // 吉
document.write('<IMG src="'+IMGNAME[RAND]+'" border="0" onclick="window.close();" style="cursor : pointer;">');
//画像を表示するhtmlタグ -->
</SCRIPT>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 11.0.2.1 for Windows">
<META http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<META http-equiv="Content-Style-Type" content="text/css">
<TITLE>おみくじ</TITLE>
<STYLE type="text/css">
<!--
BODY{
padding-top : 0px;
padding-left : 0px;
padding-right : 0px;
padding-bottom : 0px;
margin-top : 0px;
margin-left : 0px;
margin-right : 0px;
margin-bottom : 0px;border-width : 0px 0px 0px 0px;}
-->
</STYLE>
</HEAD>
<BODY>
<P align="center"><BR>
<SCRIPT language="JAVASCRIPT">
<!--
//ケイエックスパソコン教室 おみくじ見本
RAND=Math.floor(Math.random()*6);
IMGNAME=new Array(5);
IMGNAME[0]="daikyo.gif"; // 大凶
IMGNAME[1]="kyo.gif"; // 凶
IMGNAME[2]="shokichi.gif"; // 小吉
IMGNAME[3]="chukichi.gif"; // 中吉
IMGNAME[4]="daikichi.gif"; // 大吉
IMGNAME[5]="kichi.gif"; // 吉
document.write('<IMG src="'+IMGNAME[RAND]+'" border="0" onclick="window.close();" style="cursor : pointer;">');
// -->
</SCRIPT><BR>
<FONT size="3" onclick="window.close();" style="cursor : pointer;">閉じる</FONT>
<BR>
<CENTER><A href="http://www.kx777.com" target="_blank">©東京のパソコン教室ケイエックス</A></CENTER>
<BR>
<BR>
</BODY>
</HTML>
<script language="JavaScript">
<!--
function openWindow() {window.open("omikuji.html","window001",'width=105,height=50,titlebar=no');}
//-->
</script>
<IMG src="omikuji.gif" width="105" height="50"
border="0" onclick="openWindow()" style="cursor
: pointer;">
設置例