≪ 問い合わせメール不具合の修正 | TOP | 文字コード変換 MT-I18Nプラグイン ≫
2007年04月12日
■ 画像をランダムに表示してジャンプ
・imagesフォルダ内の「1.gif」などの画像をランダムで表示させてそれぞれのリンクに飛ばす。
<SCRIPT Language="JavaScript">
<!--
function randomJump()
{ theURL = new Array();
theURL[0] = "http://hogehoge.com";
theURL[1] = "http://hogehoge2.com";
theURL[2] = "http://hogehoge3.com";
theURL[3] = "http://hogehoge4.com";
ImageCount = 4; // 画像の最大枚数
num = Math.floor(Math.random() * ImageCount);
document.write("<a href='"+theURL[num]+"' target='_blank'>");
document.write("<img src='images/"+num+".gif' border='0'></a>");
}
// -->
</SCRIPT>
・画像を表示させたい箇所に下記を記載
<SCRIPT Language="JavaScript">
<!--
randomJump();
// -->
</SCRIPT>
2007年04月12日 09:29
トラックバック
このエントリーのトラックバックURL:
http://open.free-creator.com/mt-tb.cgi/176